ttypedarray.nim 901 B

1234567891011121314151617181920212223242526
  1. discard """
  2. matrix: "--jsbigint64:off -d:nimStringHash2; --jsbigint64:on"
  3. """
  4. import std/private/jsutils
  5. proc main()=
  6. template fn(a): untyped = jsConstructorName(a)
  7. doAssert fn(array[2, int8].default) == "Int8Array"
  8. doAssert fn(array[2, uint8].default) == "Uint8Array"
  9. doAssert fn(array[2, byte].default) == "Uint8Array"
  10. doAssert fn(array[2, char].default) == "Uint8Array"
  11. when not jsNoBigInt64:
  12. doAssert fn(array[2, uint64].default) == "BigUint64Array"
  13. doAssert fn([1'u8]) == "Uint8Array"
  14. doAssert fn([1'u16]) == "Uint16Array"
  15. doAssert fn([byte(1)]) == "Uint8Array"
  16. doAssert fn([1.0'f32]) == "Float32Array"
  17. doAssert fn(array[2, float32].default) == "Float32Array"
  18. doAssert fn(array[2, float].default) == "Float64Array"
  19. doAssert fn(array[2, float64].default) == "Float64Array"
  20. doAssert fn([1.0]) == "Float64Array"
  21. doAssert fn([1.0'f64]) == "Float64Array"
  22. main()