2011-09-07 08:35:18 +02:00
|
|
|
// Copyright 2009 the Sputnik authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
2014-07-22 01:09:02 +02:00
|
|
|
/*---
|
2018-01-05 18:26:51 +01:00
|
|
|
info: |
|
2014-07-22 01:09:02 +02:00
|
|
|
Number([value]) returns a number value (not a Number object) computed by
|
|
|
|
ToNumber(value) if value was supplied
|
2014-07-25 00:41:42 +02:00
|
|
|
es5id: 15.7.1.1_A1
|
2014-07-22 01:09:02 +02:00
|
|
|
description: Used values "10", 10, new String("10"), new Object(10) and "abc"
|
|
|
|
---*/
|
2021-08-11 22:08:22 +02:00
|
|
|
assert.sameValue(typeof Number("10"), "number", 'The value of `typeof Number("10")` is expected to be "number"');
|
|
|
|
assert.sameValue(typeof Number(10), "number", 'The value of `typeof Number(10)` is expected to be "number"');
|
2011-09-07 08:35:18 +02:00
|
|
|
|
2021-08-11 22:08:22 +02:00
|
|
|
assert.sameValue(
|
|
|
|
typeof Number(new String("10")),
|
|
|
|
"number",
|
|
|
|
'The value of `typeof Number(new String("10"))` is expected to be "number"'
|
|
|
|
);
|
2011-09-07 08:35:18 +02:00
|
|
|
|
2021-08-11 22:08:22 +02:00
|
|
|
assert.sameValue(
|
|
|
|
typeof Number(new Object(10)),
|
|
|
|
"number",
|
|
|
|
'The value of `typeof Number(new Object(10))` is expected to be "number"'
|
|
|
|
);
|
2011-09-07 08:35:18 +02:00
|
|
|
|
2021-08-11 22:08:22 +02:00
|
|
|
assert.sameValue(Number("abc"), NaN, 'Number("abc") returns NaN');
|
2022-03-24 21:52:05 +01:00
|
|
|
assert.sameValue(Number("INFINITY"), NaN, 'Number("INFINITY") returns NaN');
|
2022-03-25 13:35:50 +01:00
|
|
|
assert.sameValue(Number("infinity"), NaN, 'Number("infinity") returns NaN');
|