Add tests for Math.{max,min} handling zeros

This commit is contained in:
Leonardo Balter 2016-06-22 12:24:57 -04:00 committed by Mike Pennisi
parent ec3a89ebb8
commit 13e01e4340
4 changed files with 42 additions and 40 deletions

View File

@ -1,20 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: +0 is considered to be larger than -0
es5id: 15.8.2.11_A3
description: Checking if Math.max(-0,+0) and Math.max(+0,-0) equals to +0
---*/
// CHECK#1
if (Math.max(-0, +0) !== +0)
{
$ERROR("#1: 'Math.max(-0, +0) !== +0'");
}
// CHECK#1
if (Math.max(+0, -0) !== +0)
{
$ERROR("#2: 'Math.max(+0, -0) !== +0'");
}

View File

@ -0,0 +1,21 @@
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-math.max
es6id: 20.2.2.24
description: >
+0 is considered to be larger than -0
info: |
Math.max ( value1, value2 , values )
The comparison of values to determine the largest value is done using the
Abstract Relational Comparison algorithm except that +0 is considered to be
larger than -0.
---*/
assert.sameValue(Math.max(0, 0), 0, "(0, 0)");
assert.sameValue(Math.max(-0, -0), -0, "(-0, -0)");
assert.sameValue(Math.max(0, -0), 0, "(0, -0)");
assert.sameValue(Math.max(-0, 0), 0, "(-0, 0)");
assert.sameValue(Math.max(0, 0, -0), 0, "(0, 0, -0)");

View File

@ -1,20 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: +0 is considered to be larger than -0
es5id: 15.8.2.12_A3
description: Checking if Math.max(-0,+0) and Math.max(+0,-0) equals to -0
---*/
// CHECK#1
if (Math.max(-0, +0) !== -0)
{
$ERROR("#1: 'Math.max(-0, +0) !== -0'");
}
// CHECK#1
if (Math.max(+0, -0) !== -0)
{
$ERROR("#2: 'Math.max(+0, -0) !== -0'");
}

View File

@ -0,0 +1,21 @@
// Copyright (C) 2016 The V8 Project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-math.min
es6id: 20.2.2.25
description: >
+0 is considered to be larger than -0
info: |
Math.min ( value1, value2 , values )
The comparison of values to determine the smallest value is done using the
Abstract Relational Comparison algorithm except that +0 is considered to be
larger than -0.
---*/
assert.sameValue(Math.min(0, 0), 0, "(0, 0)");
assert.sameValue(Math.min(-0, -0), -0, "(-0, -0)");
assert.sameValue(Math.min(0, -0), -0, "(0, -0)");
assert.sameValue(Math.min(-0, 0), -0, "(-0, 0)");
assert.sameValue(Math.min(0, 0, -0), -0, "(0, 0, -0)");