mirror of https://github.com/tc39/test262.git
Add tests for Math.{max,min} handling zeros
This commit is contained in:
parent
ec3a89ebb8
commit
13e01e4340
|
@ -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'");
|
|
||||||
}
|
|
|
@ -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)");
|
|
@ -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'");
|
|
||||||
}
|
|
|
@ -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)");
|
Loading…
Reference in New Issue