summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ctypes/argument-type-int64.js
blob: e147b98a482474fa0cc602a301aea2192547c98b (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
25
26
27
28
load(libdir + 'asserts.js');

function test() {
  assertRangeErrorMessage(() => { ctypes.Int64(0).toString("a"); },
                         "argument of Int64.prototype.toString must be an integer at least 2 and no greater than 36");
  assertTypeErrorMessage(() => { ctypes.Int64.compare(1, 2); },
                         "first argument of Int64.compare must be a Int64");
  assertTypeErrorMessage(() => { ctypes.Int64.compare(ctypes.Int64(0), 2); },
                         "second argument of Int64.compare must be a Int64");
  assertTypeErrorMessage(() => { ctypes.Int64.lo(1); },
                         "argument of Int64.lo must be a Int64");
  assertTypeErrorMessage(() => { ctypes.Int64.hi(1); },
                         "argument of Int64.hi must be a Int64");

  assertRangeErrorMessage(() => { ctypes.UInt64(0).toString("a"); },
                         "argument of UInt64.prototype.toString must be an integer at least 2 and no greater than 36");
  assertTypeErrorMessage(() => { ctypes.UInt64.compare(1, 2); },
                         "first argument of UInt64.compare must be a UInt64");
  assertTypeErrorMessage(() => { ctypes.UInt64.compare(ctypes.UInt64(0), 2); },
                         "second argument of UInt64.compare must be a UInt64");
  assertTypeErrorMessage(() => { ctypes.UInt64.lo(1); },
                         "argument of UInt64.lo must be a UInt64");
  assertTypeErrorMessage(() => { ctypes.UInt64.hi(1); },
                         "argument of UInt64.hi must be a UInt64");
}

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