summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ctypes/incompatible-int64.js
blob: 3d53efba63ab930ba58e52b3e25f80e9f13317c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
load(libdir + 'asserts.js');

function test() {
  assertTypeErrorMessage(() => { ctypes.Int64(0).toString.call(1); },
                         "Int64.prototype.toString called on incompatible Number");
  assertTypeErrorMessage(() => { ctypes.Int64(0).toString.call(ctypes.int32_t(0)); },
                         "Int64.prototype.toString called on non-Int64 CData");
  assertTypeErrorMessage(() => { ctypes.Int64(0).toSource.call(1); },
                         "Int64.prototype.toSource called on incompatible Number");
  assertTypeErrorMessage(() => { ctypes.Int64(0).toSource.call(ctypes.int32_t(0)); },
                         "Int64.prototype.toSource called on non-Int64 CData");

  assertTypeErrorMessage(() => { ctypes.UInt64(0).toString.call(1); },
                         "UInt64.prototype.toString called on incompatible Number");
  assertTypeErrorMessage(() => { ctypes.UInt64(0).toString.call(ctypes.int32_t(0)); },
                         "UInt64.prototype.toString called on non-UInt64 CData");
  assertTypeErrorMessage(() => { ctypes.UInt64(0).toSource.call(1); },
                         "UInt64.prototype.toSource called on incompatible Number");
  assertTypeErrorMessage(() => { ctypes.UInt64(0).toSource.call(ctypes.int32_t(0)); },
                         "UInt64.prototype.toSource called on non-UInt64 CData");
}

if (typeof ctypes === "object")
  test();