diff options
Diffstat (limited to 'deps/v8/test/js-perf-test/Numbers/toNumber.js')
-rw-r--r-- | deps/v8/test/js-perf-test/Numbers/toNumber.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/deps/v8/test/js-perf-test/Numbers/toNumber.js b/deps/v8/test/js-perf-test/Numbers/toNumber.js new file mode 100644 index 00000000000..44382f092be --- /dev/null +++ b/deps/v8/test/js-perf-test/Numbers/toNumber.js @@ -0,0 +1,25 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +const A = [undefined, 12, "123"]; + +function NumberConstructor() { + Number.isNaN(Number(A[0])) + Number.isNaN(Number(A[1])) + Number.isNaN(Number(A[2])) +} +createSuite('Constructor', 1000, NumberConstructor, ()=>{}); + +function NumberPlus() { + Number.isNaN(+(A[0])) + Number.isNaN(+(A[1])) + Number.isNaN(+(A[2])) +} +createSuite('UnaryPlus', 1000, NumberPlus, ()=>{}); + +function NumberParseFloat() { + Number.isNaN(parseFloat(A[0])) + Number.isNaN(parseFloat(A[1])) + Number.isNaN(parseFloat(A[2])) +} +createSuite('ParseFloat', 1000, NumberParseFloat, ()=>{}); |