assert: support `Float16Array` in loose deep equality checks · nodejs/node@4252dc7 · GitHub
Skip to content

Commit 4252dc7

Browse files
LiviaMedeirosaduh95
authored andcommitted
assert: support Float16Array in loose deep equality checks
PR-URL: #57881 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 3c65058 commit 4252dc7

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

lib/internal/util/comparisons.js

Lines changed: 3 additions & 1 deletion

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
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');
46
const vm = require('node:vm');
57
const assert = require('node:assert');
68
const { describe, it } = require('node:test');
79

10+
// TODO(LiviaMedeiros): once linter recognizes `Float16Array`, remove next line
11+
const { Float16Array } = globalThis;
12+
813
const x = ['x'];
914

1015
function createCircularObject() {
@@ -484,6 +489,11 @@ describe('Object Comparison Tests', () => {
484489
actual: { dataView: new Uint8Array(3) },
485490
expected: { dataView: new DataView(new ArrayBuffer(3)) },
486491
},
492+
{
493+
description: 'throws when comparing Float16Array([+0.0]) with Float16Array([-0.0])',
494+
actual: new Float16Array([+0.0]),
495+
expected: new Float16Array([-0.0]),
496+
},
487497
{
488498
description: 'throws when comparing Float32Array([+0.0]) with Float32Array([-0.0])',
489499
actual: new Float32Array([+0.0]),

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

Lines changed: 9 additions & 0 deletions

0 commit comments

Comments
 (0)