From 88b013ff7f8d5811cc4d61c60efacccfe584ff9d Mon Sep 17 00:00:00 2001 From: "Ioanna M. Dimitriou H" Date: Tue, 9 Jul 2024 20:21:09 +0200 Subject: [PATCH] Adds missing test file for Array.prototype.includes --- .../resizable-buffer-special-float-values.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/built-ins/Array/prototype/includes/resizable-buffer-special-float-values.js diff --git a/test/built-ins/Array/prototype/includes/resizable-buffer-special-float-values.js b/test/built-ins/Array/prototype/includes/resizable-buffer-special-float-values.js new file mode 100644 index 0000000000..1908d833eb --- /dev/null +++ b/test/built-ins/Array/prototype/includes/resizable-buffer-special-float-values.js @@ -0,0 +1,22 @@ +// Copyright 2023 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-%array%.prototype.includes +description: > + Array.p.includes behaves correctly for special float values on float + TypedArrays backed by resizable buffers. +includes: [resizableArrayBufferUtils.js] +features: [resizable-arraybuffer, Array.prototype.includes] +---*/ + +for (let ctor of floatCtors) { + const rab = CreateResizableArrayBuffer(4 * ctor.BYTES_PER_ELEMENT, 8 * ctor.BYTES_PER_ELEMENT); + const lengthTracking = new ctor(rab); + lengthTracking[0] = -Infinity; + lengthTracking[1] = Infinity; + lengthTracking[2] = NaN; + assert(Array.prototype.includes.call(lengthTracking, -Infinity)); + assert(Array.prototype.includes.call(lengthTracking, Infinity)); + assert(Array.prototype.includes.call(lengthTracking, NaN)); +}