summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/intl402/NumberFormat/prototype/format/engineering-scientific-zh-TW.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/intl402/NumberFormat/prototype/format/engineering-scientific-zh-TW.js')
-rw-r--r--js/src/tests/test262/intl402/NumberFormat/prototype/format/engineering-scientific-zh-TW.js78
1 files changed, 78 insertions, 0 deletions
diff --git a/js/src/tests/test262/intl402/NumberFormat/prototype/format/engineering-scientific-zh-TW.js b/js/src/tests/test262/intl402/NumberFormat/prototype/format/engineering-scientific-zh-TW.js
new file mode 100644
index 0000000000..5f4cacbb0b
--- /dev/null
+++ b/js/src/tests/test262/intl402/NumberFormat/prototype/format/engineering-scientific-zh-TW.js
@@ -0,0 +1,78 @@
+// Copyright 2019 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-intl.numberformat.prototype.format
+description: Checks handling of the engineering and scientific notations.
+locale: [zh-TW]
+features: [Intl.NumberFormat-unified]
+---*/
+
+
+const tests = [
+ [
+ 0.000345,
+ "345E-6",
+ "3.45E-4",
+ ],
+ [
+ 0.345,
+ "345E-3",
+ "3.45E-1",
+ ],
+ [
+ 3.45,
+ "3.45E0",
+ "3.45E0",
+ ],
+ [
+ 34.5,
+ "34.5E0",
+ "3.45E1",
+ ],
+ [
+ 543,
+ "543E0",
+ "5.43E2",
+ ],
+ [
+ 5430,
+ "5.43E3",
+ "5.43E3",
+ ],
+ [
+ 543000,
+ "543E3",
+ "5.43E5",
+ ],
+ [
+ 543211.1,
+ "543.211E3",
+ "5.432E5",
+ ],
+ [
+ -Infinity,
+ "-∞",
+ "-∞",
+ ],
+ [
+ Infinity,
+ "∞",
+ "∞",
+ ],
+ [
+ NaN,
+ "非數值",
+ "非數值",
+ ],
+];
+
+for (const [number, engineering, scientific] of tests) {
+ const nfEngineering = (new Intl.NumberFormat("zh-TW", { notation: "engineering" }));
+ assert.sameValue(nfEngineering.format(number), engineering);
+ const nfScientific = (new Intl.NumberFormat("zh-TW", { notation: "scientific" }));
+ assert.sameValue(nfScientific.format(number), scientific);
+}
+
+
+reportCompare(0, 0);