MCPcopy Create free account
hub / github.com/nodejs/node / testDateFunctionWithValueNoRecoverNaN

Function testDateFunctionWithValueNoRecoverNaN

deps/v8/test/webkit/date-set-to-nan.js:73–101  ·  view source on GitHub ↗
(functionNameRoot, steps)

Source from the content-addressed store, hash-verified

71];
72
73function testDateFunctionWithValueNoRecoverNaN(functionNameRoot, steps)
74{
75 var date = new Date();
76 var setValue = date["get" + functionNameRoot]();
77 date.setMilliseconds(Number.NaN);
78 var params = [
79 "",
80 ", 0",
81 ", 0, 0",
82 ", 0, 0, 0"
83 ];
84 var setResult = (1 == steps) ? date["set" + functionNameRoot](setValue)
85 : ((2 == steps) ? date["set" + functionNameRoot](setValue, 0)
86 : ((3 == steps) ? date["set" + functionNameRoot](setValue, 0, 0)
87 : date["set" + functionNameRoot](setValue, 0, 0, 0)));
88 if (!isNaN(setResult)) {
89 testFailed("date(NaN).set" + functionNameRoot + "(" + setValue + params[steps - 1]
90 + ") was " + setResult + " instead of NaN");
91 return false;
92 }
93 var getResult = date["get" + functionNameRoot]();
94 if (!isNaN(getResult)) {
95 testFailed("date.get" + functionNameRoot + "() was " + getResult + " instead of NaN");
96 return false;
97 }
98 testPassed ("no recovering from NaN date using date.set" + functionNameRoot
99 + "(arg0" + params[steps - 1] + ")");
100 return true;
101}
102
103function testDateFunctionWithValueRecoverTime(functionNameRoot)
104{

Callers 1

testDateFunctionFunction · 0.85

Calls 2

testFailedFunction · 0.85
testPassedFunction · 0.85

Tested by

no test coverage detected