Replace runTestCase with assert helpers [test/built-ins/Number]

This commit is contained in:
André Bargull 2015-08-06 18:26:38 +02:00
parent 33a7e03a76
commit 6cd7b9e275
11 changed files with 17 additions and 75 deletions

View File

@ -4,12 +4,6 @@
/*---
es5id: 15.7.3-1
description: Number constructor - [[Prototype]] is the Function prototype object
includes: [runTestCase.js]
---*/
function testcase() {
if (Function.prototype.isPrototypeOf(Number) === true) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Function.prototype.isPrototypeOf(Number), true, 'Function.prototype.isPrototypeOf(Number)');

View File

@ -6,13 +6,8 @@ es5id: 15.7.3-2
description: >
Number constructor - [[Prototype]] is the Function prototype
object (using getPrototypeOf)
includes: [runTestCase.js]
---*/
function testcase() {
var p = Object.getPrototypeOf(Number);
if (p === Function.prototype) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(p, Function.prototype, 'p');

View File

@ -4,12 +4,9 @@
/*---
es5id: 15.7.4-1
description: "Number prototype object: its [[Class]] must be 'Object'"
includes: [runTestCase.js]
---*/
function testcase() {
var numProto = Object.getPrototypeOf(new Number(42));
var s = Object.prototype.toString.call(numProto );
return (s === '[object Object]') ;
}
runTestCase(testcase);
assert.sameValue(s, '[object Object]', 's');

View File

@ -5,12 +5,6 @@
es6id: 20.1.2.3
author: Ryan Lewis
description: Number.isInteger should return false if called with a double.
includes: [runTestCase.js]
---*/
function testcase() {
if(Number.isInteger(6.75) === false) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Number.isInteger(6.75), false, 'Number.isInteger(6.75)');

View File

@ -5,12 +5,6 @@
es6id: 20.1.2.3
author: Ryan Lewis
description: Number.isInteger should return false if called with Infinity.
includes: [runTestCase.js]
---*/
function testcase() {
if(Number.isInteger(Infinity) === false) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Number.isInteger(Infinity), false, 'Number.isInteger(Infinity)');

View File

@ -5,12 +5,6 @@
es6id: 20.1.2.3
author: Ryan Lewis
description: Number.isInteger should return false if called with NaN.
includes: [runTestCase.js]
---*/
function testcase() {
if(Number.isInteger(NaN) === false) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Number.isInteger(NaN), false, 'Number.isInteger(NaN)');

View File

@ -7,12 +7,6 @@ author: Ryan Lewis
description: >
Number.isInteger should return false if called with a string
(non-Number)
includes: [runTestCase.js]
---*/
function testcase() {
if(Number.isInteger('2') === false) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Number.isInteger('2'), false, 'Number.isInteger("2")');

View File

@ -7,12 +7,6 @@ author: Ryan Lewis
description: >
Number.isInteger should return false if called with a string
(non-Number)
includes: [runTestCase.js]
---*/
function testcase() {
if(Number.isInteger('word') === false) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Number.isInteger('word'), false, 'Number.isInteger("word")');

View File

@ -5,12 +5,6 @@
es6id: 20.1.2.3
author: Ryan Lewis
description: Number.isInteger should return true if called with an integer.
includes: [runTestCase.js]
---*/
function testcase() {
if(Number.isInteger(478) === true) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(Number.isInteger(478), true, 'Number.isInteger(478)');

View File

@ -6,16 +6,11 @@ es5id: 15.7.3.1-1
description: >
Number.prototype is a data property with default attribute values
(false)
includes: [runTestCase.js]
---*/
function testcase() {
var d = Object.getOwnPropertyDescriptor(Number, 'prototype');
if (d.writable === false &&
d.enumerable === false &&
d.configurable === false) {
return true;
}
}
runTestCase(testcase);
assert.sameValue(d.writable, false, 'd.writable');
assert.sameValue(d.enumerable, false, 'd.enumerable');
assert.sameValue(d.configurable, false, 'd.configurable');

View File

@ -4,11 +4,8 @@
/*---
es5id: 15.7.3.1-2
description: Number.prototype, initial value is the Number prototype object
includes: [runTestCase.js]
---*/
function testcase() {
// assume that Number.prototype has not been modified.
return Object.getPrototypeOf(new Number(42))===Number.prototype;
}
runTestCase(testcase);
assert.sameValue(Object.getPrototypeOf(new Number(42)), Number.prototype, 'Object.getPrototypeOf(new Number(42))');