summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Number/prototype/toString/S15.7.4.2_A1_T02.js
blob: 1d7e7b6693cb22d12727a3f95acc5d42b0be0f45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
info: |
    toString: If radix is the number 10 or undefined, then this
    number value is given as an argument to the ToString operator.
    the resulting string value is returned
es5id: 15.7.4.2_A1_T02
description: radix is 10
---*/
assert.sameValue(Number.prototype.toString(10), "0", 'Number.prototype.toString(10) must return "0"');
assert.sameValue((new Number()).toString(10), "0", '(new Number()).toString(10) must return "0"');
assert.sameValue((new Number(0)).toString(10), "0", '(new Number(0)).toString(10) must return "0"');
assert.sameValue((new Number(-1)).toString(10), "-1", '(new Number(-1)).toString(10) must return "-1"');
assert.sameValue((new Number(1)).toString(10), "1", '(new Number(1)).toString(10) must return "1"');

assert.sameValue(
  (new Number(Number.NaN)).toString(10),
  "NaN",
  '(new Number(Number.NaN)).toString(10) must return "NaN"'
);

assert.sameValue(
  (new Number(Number.POSITIVE_INFINITY)).toString(10),
  "Infinity",
  '(new Number(Number.POSITIVE_INFINITY)).toString(10) must return "Infinity"'
);

assert.sameValue(
  (new Number(Number.NEGATIVE_INFINITY)).toString(10),
  "-Infinity",
  '(new Number(Number.NEGATIVE_INFINITY)).toString(10) must return "-Infinity"'
);

reportCompare(0, 0);