Skip to content

Commit 64c6103

Browse files
committed
squash: add Float16Array to assert tests
1 parent 41b2697 commit 64c6103

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

test/parallel/test-assert-partial-deep-equal.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Flags: --js-float16array
2+
// TODO(LiviaMedeiros): once `Float16Array` is unflagged in v8, remove the line above
13
'use strict';
24

35
const common = require('../common');
@@ -494,6 +496,11 @@ describe('Object Comparison Tests', () => {
494496
actual: { dataView: new Uint8Array(3) },
495497
expected: { dataView: new DataView(new ArrayBuffer(3)) },
496498
},
499+
{
500+
description: 'throws when comparing Float16Array([+0.0]) with Float16Array([-0.0])',
501+
actual: new Float16Array([+0.0]),
502+
expected: new Float16Array([-0.0]),
503+
},
497504
{
498505
description: 'throws when comparing Float32Array([+0.0]) with Float32Array([-0.0])',
499506
actual: new Float32Array([+0.0]),

test/parallel/test-assert-typedarray-deepequal.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Flags: --js-float16array
2+
// TODO(LiviaMedeiros): once `Float16Array` is unflagged in v8, remove the line above
13
'use strict';
24

35
require('../common');
@@ -20,6 +22,7 @@ suite('equalArrayPairs', () => {
2022
[new Int8Array(1e5), new Int8Array(1e5)],
2123
[new Int16Array(1e5), new Int16Array(1e5)],
2224
[new Int32Array(1e5), new Int32Array(1e5)],
25+
[new Float16Array(1e5), new Float16Array(1e5)],
2326
[new Float32Array(1e5), new Float32Array(1e5)],
2427
[new Float64Array(1e5), new Float64Array(1e5)],
2528
[new Float32Array([+0.0]), new Float32Array([+0.0])],
@@ -41,6 +44,7 @@ suite('equalArrayPairs', () => {
4144

4245
suite('looseEqualArrayPairs', () => {
4346
const looseEqualArrayPairs = [
47+
[new Float16Array([+0.0]), new Float16Array([-0.0])],
4448
[new Float32Array([+0.0]), new Float32Array([-0.0])],
4549
[new Float64Array([+0.0]), new Float64Array([-0.0])],
4650
];
@@ -71,6 +75,8 @@ suite('notEqualArrayPairs', () => {
7175
[new Int16Array([0]), new Uint16Array([256])],
7276
[new Int16Array([-256]), new Uint16Array([0xff00])], // same bits
7377
[new Int32Array([-256]), new Uint32Array([0xffffff00])], // ditto
78+
[new Float16Array([Number.EPSILON]), new Float16Array([0.0])],
79+
[new Float16Array([0.1]), new Float16Array([0.1, 0.2])],
7480
[new Float32Array([0.1]), new Float32Array([0.0])],
7581
[new Float32Array([0.1]), new Float32Array([0.1, 0.2])],
7682
[new Float64Array([0.1]), new Float64Array([0.0])],

0 commit comments

Comments
 (0)