Skip to content

Commit

Permalink
WIP generated type coercion tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Wolfe committed Nov 2, 2017
1 parent 7b4cdd3 commit 1adfab8
Show file tree
Hide file tree
Showing 8 changed files with 3,251 additions and 171 deletions.
714 changes: 689 additions & 25 deletions test/built-ins/BigInt/asIntN/bigint-tobigint.js

Large diffs are not rendered by default.

474 changes: 453 additions & 21 deletions test/built-ins/BigInt/asIntN/bits-toindex.js

Large diffs are not rendered by default.

714 changes: 689 additions & 25 deletions test/built-ins/BigInt/asUintN/bigint-tobigint.js

Large diffs are not rendered by default.

474 changes: 453 additions & 21 deletions test/built-ins/BigInt/asUintN/bits-toindex.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
// Copyright (C) 2017 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

// This file was procedurally generated.
/*---
description: Boolean littleEndian argument coerced in ToBoolean
esid: sec-dataview.prototype.getbigint64
description: >
Boolean littleEndian argument coerced in ToBoolean
info: |
DataView.prototype.getBigInt64 ( byteOffset [ , littleEndian ] )
Expand Down Expand Up @@ -32,22 +29,24 @@ info: |
...
2. If isLittleEndian is false, reverse the order of the elements of rawBytes.
...
includes: [typeCoercion.js]
features: [DataView, ArrayBuffer, DataView.prototype.setUint8, BigInt, Symbol, Symbol.toPrimitive]
flags: [generated]
features: [ArrayBuffer, BigInt, DataView, DataView.prototype.setUint8, Symbol]
---*/

var buffer = new ArrayBuffer(8);
var sample = new DataView(buffer, 0);

sample.setUint8(7, 0xff);

// False
assert.sameValue(sample.getBigInt64(0), 0xffn, "no argument");
testCoercibleToBooleanFalse(function (x) {
assert.sameValue(sample.getBigInt64(0, x), 0xffn);
});

// True
testCoercibleToBooleanTrue(function (x) {
assert.sameValue(sample.getBigInt64(0, x), -0x100000000000000n);
});
assert.sameValue(sample.getBigInt64(0, undefined), 0xffn);
assert.sameValue(sample.getBigInt64(0, null), 0xffn);
assert.sameValue(sample.getBigInt64(0, false), 0xffn);
assert.sameValue(sample.getBigInt64(0, 0), 0xffn);
assert.sameValue(sample.getBigInt64(0, -0), 0xffn);
assert.sameValue(sample.getBigInt64(0, NaN), 0xffn);
assert.sameValue(sample.getBigInt64(0, ""), 0xffn);
assert.sameValue(sample.getBigInt64(0, true), -0x100000000000000n);
assert.sameValue(sample.getBigInt64(0, 1), -0x100000000000000n);
assert.sameValue(sample.getBigInt64(0, "string"), -0x100000000000000n);
assert.sameValue(sample.getBigInt64(0, Symbol("1")), -0x100000000000000n);
assert.sameValue(sample.getBigInt64(0, {}), -0x100000000000000n);
410 changes: 387 additions & 23 deletions test/built-ins/DataView/prototype/getBigInt64/toindex-byteoffset.js

Large diffs are not rendered by default.

402 changes: 381 additions & 21 deletions test/built-ins/String/prototype/indexOf/position-tointeger.js

Large diffs are not rendered by default.

201 changes: 183 additions & 18 deletions test/built-ins/String/prototype/indexOf/searchstring-tostring.js

Large diffs are not rendered by default.

0 comments on commit 1adfab8

Please sign in to comment.