@@ -4,25 +4,25 @@ var { num2hanzi, hanzi2num, hanzi2numstr } = require("../src/hanzi2num");
4
4
describe ( "hanzi2num" , ( ) => {
5
5
describe ( "num2hanzi(0.53212121222)" , ( ) => {
6
6
it ( "should translate float number to hanzi correctly" , ( ) => {
7
- assert . equal ( num2hanzi ( 0.53212121222 ) , "五分三釐二毫一絲二忽一微二纖一沙二塵二埃二渺" ) ;
7
+ assert . strictEqual ( num2hanzi ( 0.53212121222 ) , "五分三釐二毫一絲二忽一微二纖一沙二塵二埃二渺" ) ;
8
8
} ) ;
9
9
} ) ;
10
10
11
11
describe ( "num2hanzi(0.5)" , ( ) => {
12
12
it ( "should translate float number to hanzi correctly" , ( ) => {
13
- assert . equal ( num2hanzi ( 0.5 ) , "五分" ) ;
13
+ assert . strictEqual ( num2hanzi ( 0.5 ) , "五分" ) ;
14
14
} ) ;
15
15
} ) ;
16
16
17
17
describe ( "hanzi2num(num2hanzi(0.532))" , ( ) => {
18
18
it ( "should translate float number and hanzi back and forth" , ( ) => {
19
- assert . equal ( hanzi2num ( num2hanzi ( 0.532 ) ) , 0.532 ) ;
19
+ assert . strictEqual ( hanzi2num ( num2hanzi ( 0.532 ) ) , 0.532 ) ;
20
20
} ) ;
21
21
} ) ;
22
22
23
23
describe ( 'num2hanzi(hanzi2num("二十一京二千三百四十五兆六千七百八十億零九百萬零二百五十有一"))' , ( ) => {
24
24
it ( "should translate float number and hanzi back and forth" , ( ) => {
25
- assert . equal (
25
+ assert . strictEqual (
26
26
num2hanzi (
27
27
hanzi2num (
28
28
"二十一京二千三百四十五兆六千七百八十億零九百萬零二百五十有一"
@@ -35,37 +35,37 @@ describe("hanzi2num", () => {
35
35
36
36
describe ( "num2hanzi(-(1e+10 + 99))" , ( ) => {
37
37
it ( "should translate small negative float numner to hanzi" , ( ) => {
38
- assert . equal ( num2hanzi ( - ( 1e+10 + 99 ) ) , "負一百億零九十九" ) ;
38
+ assert . strictEqual ( num2hanzi ( - ( 1e+10 + 99 ) ) , "負一百億零九十九" ) ;
39
39
} ) ;
40
40
} ) ;
41
41
42
42
describe ( "num2hanzi(0)" , ( ) => {
43
43
it ( "should translate 0 to hanzi" , ( ) => {
44
- assert . equal ( num2hanzi ( 0 ) , "零" ) ;
44
+ assert . strictEqual ( num2hanzi ( 0 ) , "零" ) ;
45
45
} ) ;
46
46
} ) ;
47
47
48
48
describe ( "num2hanzi(-0.765433)" , ( ) => {
49
49
it ( "should translate negative float number" , ( ) => {
50
- assert . equal ( num2hanzi ( - 0.765433 ) , "負七分六釐五毫四絲三忽三微" ) ;
50
+ assert . strictEqual ( num2hanzi ( - 0.765433 ) , "負七分六釐五毫四絲三忽三微" ) ;
51
51
} ) ;
52
52
} ) ;
53
53
54
54
describe ( 'hanzi2num("負一又二分三釐四毫五絲六忽七微")' , ( ) => {
55
55
it ( "should translate hanzi to number correctly" , ( ) => {
56
- assert . equal ( hanzi2num ( "負一又二分三釐四毫五絲六忽七微" ) , - 1.234567 ) ;
56
+ assert . strictEqual ( hanzi2num ( "負一又二分三釐四毫五絲六忽七微" ) , - 1.234567 ) ;
57
57
} ) ;
58
58
} ) ;
59
59
60
60
describe ( 'hanzi2num("一沙一塵")' , ( ) => {
61
61
it ( "should translate hanzi to number correctly" , ( ) => {
62
- assert . equal ( hanzi2num ( "一沙一塵" ) , 1.1e-8 ) ;
62
+ assert . strictEqual ( hanzi2num ( "一沙一塵" ) , 1.1e-8 ) ;
63
63
} ) ;
64
64
} ) ;
65
65
66
66
describe ( 'hanzi2numstr("二十一京二千三百四十五兆六千七百八十億零九百萬零二百五十有一")' , ( ) => {
67
67
it ( "should translate hanzi to number correctly" , ( ) => {
68
- assert . equal (
68
+ assert . strictEqual (
69
69
hanzi2numstr (
70
70
"二十一京二千三百四十五兆六千七百八十億零九百萬零二百五十有一"
71
71
) ,
@@ -76,43 +76,43 @@ describe("hanzi2num", () => {
76
76
77
77
describe ( 'hanzi2numstr("一極零二")' , ( ) => {
78
78
it ( "should translate hanzi to number correctly" , ( ) => {
79
- assert . equal (
79
+ assert . strictEqual (
80
80
hanzi2numstr ( "一極零二" ) ,
81
81
"1000000000000000000000000000000000000000000000002" ) ;
82
82
} ) ;
83
83
} ) ;
84
84
85
85
describe ( 'hanzi2numstr("一極零二又三漠")' , ( ) => {
86
86
it ( "should translate hanzi to number correctly" , ( ) => {
87
- assert . equal (
87
+ assert . strictEqual (
88
88
hanzi2numstr ( "一極零二又三漠" ) ,
89
89
"1000000000000000000000000000000000000000000000002.000000000003" ) ;
90
90
} ) ;
91
91
} ) ;
92
92
93
93
describe ( 'hanzi2numstr("一極零二京")' , ( ) => {
94
94
it ( "should translate hanzi to number correctly" , ( ) => {
95
- assert . equal (
95
+ assert . strictEqual (
96
96
hanzi2numstr ( "一極零二京" ) ,
97
97
"1.00000000000000000000000000000002e+48" ) ;
98
98
} ) ;
99
99
} ) ;
100
100
101
101
describe ( 'hanzi2num("極")' , ( ) => {
102
102
it ( "should translate hanzi to number correctly" , ( ) => {
103
- assert . equal ( hanzi2num ( "極" ) , 1e+48 ) ;
103
+ assert . strictEqual ( hanzi2num ( "極" ) , 1e+48 ) ;
104
104
} ) ;
105
105
} ) ;
106
106
107
107
describe ( 'hanzi2num("三十二又一分")' , ( ) => {
108
108
it ( "should translate hanzi to number correctly" , ( ) => {
109
- assert . equal ( hanzi2num ( "三十二又一分" ) , 32.1 ) ;
109
+ assert . strictEqual ( hanzi2num ( "三十二又一分" ) , 32.1 ) ;
110
110
} ) ;
111
111
} ) ;
112
112
113
113
describe ( 'hanzi2num("二分七釐三毫一絲二忽三微四纖五沙三塵一埃")' , ( ) => {
114
114
it ( "should translate hanzi to number correctly" , ( ) => {
115
- assert . equal (
115
+ assert . strictEqual (
116
116
hanzi2num ( "二分七釐三毫一絲二忽三微四纖五沙三塵一埃" ) ,
117
117
0.2731234531
118
118
) ;
@@ -121,103 +121,103 @@ describe("hanzi2num", () => {
121
121
122
122
describe ( 'hanzi2num("一漠")' , ( ) => {
123
123
it ( "should translate hanzi to number correctly" , ( ) => {
124
- assert . equal ( hanzi2num ( "一漠" ) , 1e-12 ) ;
124
+ assert . strictEqual ( hanzi2num ( "一漠" ) , 1e-12 ) ;
125
125
} ) ;
126
126
} ) ;
127
127
128
128
describe ( 'hanzi2num("三千萬埃")' , ( ) => {
129
129
it ( "should translate hanzi to number correctly" , ( ) => {
130
- assert . equal ( hanzi2num ( "三千萬埃" ) , 0.003 ) ;
130
+ assert . strictEqual ( hanzi2num ( "三千萬埃" ) , 0.003 ) ;
131
131
} ) ;
132
132
} ) ;
133
133
134
134
describe ( 'hanzi2num("三十二")' , ( ) => {
135
135
it ( "should translate hanzi to number correctly" , ( ) => {
136
- assert . equal ( hanzi2num ( "三十二" ) , 32 ) ;
136
+ assert . strictEqual ( hanzi2num ( "三十二" ) , 32 ) ;
137
137
} ) ;
138
138
} ) ;
139
139
140
140
describe ( 'hanzi2num("極極極極極極")' , ( ) => {
141
141
it ( "should translate hanzi to number correctly" , ( ) => {
142
- assert . equal ( hanzi2num ( "極極極極極極" ) , 1e288 ) ;
142
+ assert . strictEqual ( hanzi2num ( "極極極極極極" ) , 1e288 ) ;
143
143
} ) ;
144
144
} ) ;
145
145
146
146
describe ( 'hanzi2num("一萬")' , ( ) => {
147
147
it ( "should translate hanzi to number correctly" , ( ) => {
148
- assert . equal ( hanzi2num ( "一萬" ) , 10000 ) ;
148
+ assert . strictEqual ( hanzi2num ( "一萬" ) , 10000 ) ;
149
149
} ) ;
150
150
} ) ;
151
151
152
152
describe ( 'hanzi2num("零")' , ( ) => {
153
153
it ( "should translate hanzi to number correctly" , ( ) => {
154
- assert . equal ( hanzi2num ( "零" ) , 0 ) ;
154
+ assert . strictEqual ( hanzi2num ( "零" ) , 0 ) ;
155
155
} ) ;
156
156
} ) ;
157
157
158
158
describe ( 'hanzi2num("二百五")' , ( ) => {
159
159
it ( "should translate hanzi to number correctly" , ( ) => {
160
- assert . equal ( hanzi2num ( "二百五" ) , 205 ) ;
160
+ assert . strictEqual ( hanzi2num ( "二百五" ) , 205 ) ;
161
161
} ) ;
162
162
} ) ;
163
163
164
164
describe ( 'hanzi2num("二百零五")' , ( ) => {
165
165
it ( "should translate hanzi to number correctly" , ( ) => {
166
- assert . equal ( hanzi2num ( "二百零五" ) , 205 ) ;
166
+ assert . strictEqual ( hanzi2num ( "二百零五" ) , 205 ) ;
167
167
} ) ;
168
168
} ) ;
169
169
170
170
describe ( 'hanzi2num("三千七")' , ( ) => {
171
171
it ( "should translate hanzi to number correctly" , ( ) => {
172
- assert . equal ( hanzi2num ( "三千七" ) , 3007 ) ;
172
+ assert . strictEqual ( hanzi2num ( "三千七" ) , 3007 ) ;
173
173
} ) ;
174
174
} ) ;
175
175
176
176
describe ( 'hanzi2num("五萬三千七")' , ( ) => {
177
177
it ( "should translate hanzi to number correctly" , ( ) => {
178
- assert . equal ( hanzi2num ( "五萬三千七" ) , 53007 ) ;
178
+ assert . strictEqual ( hanzi2num ( "五萬三千七" ) , 53007 ) ;
179
179
} ) ;
180
180
} ) ;
181
181
182
182
describe ( 'hanzi2num("五萬三千零七")' , ( ) => {
183
183
it ( "should translate hanzi to number correctly" , ( ) => {
184
- assert . equal ( hanzi2num ( "五萬三千零七" ) , 53007 ) ;
184
+ assert . strictEqual ( hanzi2num ( "五萬三千零七" ) , 53007 ) ;
185
185
} ) ;
186
186
} ) ;
187
187
188
188
describe ( 'hanzi2num("十萬")' , ( ) => {
189
189
it ( "should translate hanzi to number correctly" , ( ) => {
190
- assert . equal ( hanzi2num ( "十萬" ) , 1e+5 ) ;
190
+ assert . strictEqual ( hanzi2num ( "十萬" ) , 1e+5 ) ;
191
191
} ) ;
192
192
} ) ;
193
193
194
194
describe ( 'hanzi2num("萬十")' , ( ) => {
195
195
it ( "should translate hanzi to number correctly" , ( ) => {
196
- assert . equal ( hanzi2num ( "萬十" ) , 10010 ) ;
196
+ assert . strictEqual ( hanzi2num ( "萬十" ) , 10010 ) ;
197
197
} ) ;
198
198
} ) ;
199
199
200
200
describe ( 'hanzi2num("萬億")' , ( ) => {
201
201
it ( "should translate hanzi to number correctly" , ( ) => {
202
- assert . equal ( hanzi2num ( "萬億" ) , 1e+12 ) ;
202
+ assert . strictEqual ( hanzi2num ( "萬億" ) , 1e+12 ) ;
203
203
} ) ;
204
204
} ) ;
205
205
206
206
describe ( 'hanzi2num("億萬")' , ( ) => {
207
207
it ( "should translate hanzi to number correctly" , ( ) => {
208
- assert . equal ( hanzi2num ( "億萬" ) , 100010000 ) ;
208
+ assert . strictEqual ( hanzi2num ( "億萬" ) , 100010000 ) ;
209
209
} ) ;
210
210
} ) ;
211
211
212
212
describe ( 'hanzi2num("三·一四一五九二六五三五八九七九三")' , ( ) => {
213
213
it ( "should translate hanzi to number correctly" , ( ) => {
214
- assert . equal ( hanzi2num ( "三·一四一五九二六五三五八九七九三" ) , Math . PI ) ;
214
+ assert . strictEqual ( hanzi2num ( "三·一四一五九二六五三五八九七九三" ) , Math . PI ) ;
215
215
} ) ;
216
216
} ) ;
217
217
218
218
describe ( 'hanzi2num("一二京三四五六兆七〇〇〇億")' , ( ) => {
219
219
it ( "should translate hanzi to number correctly" , ( ) => {
220
- assert . equal ( hanzi2num ( "一二京三四五六兆七〇〇〇億" ) , 1.234567e+17 ) ;
220
+ assert . strictEqual ( hanzi2num ( "一二京三四五六兆七〇〇〇億" ) , 1.234567e+17 ) ;
221
221
} ) ;
222
222
} ) ;
223
223
@@ -229,19 +229,19 @@ describe("hanzi2num", () => {
229
229
230
230
describe ( 'hanzi2num("一百又五絲")' , ( ) => {
231
231
it ( "should translate hanzi to number correctly" , ( ) => {
232
- assert . equal ( hanzi2num ( "一百又五絲" ) , 100.0005 ) ;
232
+ assert . strictEqual ( hanzi2num ( "一百又五絲" ) , 100.0005 ) ;
233
233
} ) ;
234
234
} ) ;
235
235
236
236
describe ( 'hanzi2num("一百零五絲")' , ( ) => {
237
237
it ( "should translate hanzi to number correctly" , ( ) => {
238
- assert . equal ( hanzi2num ( "一百零五絲" ) , 0.0105 ) ;
238
+ assert . strictEqual ( hanzi2num ( "一百零五絲" ) , 0.0105 ) ;
239
239
} ) ;
240
240
} ) ;
241
241
242
242
describe ( 'hanzi2num("一千又五百")' , ( ) => {
243
243
it ( "should translate hanzi to number correctly" , ( ) => {
244
- assert . equal ( hanzi2num ( "一千又五百" ) , 1500 ) ;
244
+ assert . strictEqual ( hanzi2num ( "一千又五百" ) , 1500 ) ;
245
245
} ) ;
246
246
} ) ;
247
247
@@ -265,7 +265,7 @@ describe("hanzi2num", () => {
265
265
266
266
describe ( 'hanzi2num("十分")' , ( ) => {
267
267
it ( "should translate hanzi to number correctly" , ( ) => {
268
- assert . equal ( hanzi2num ( "十分" ) , 1 ) ;
268
+ assert . strictEqual ( hanzi2num ( "十分" ) , 1 ) ;
269
269
} ) ;
270
270
} ) ;
271
271
@@ -277,7 +277,7 @@ describe("hanzi2num", () => {
277
277
278
278
describe ( 'hanzi2num("一分十絲")' , ( ) => {
279
279
it ( "should translate hanzi to number correctly" , ( ) => {
280
- assert . equal ( hanzi2num ( "一分十絲" ) , 0.101 ) ;
280
+ assert . strictEqual ( hanzi2num ( "一分十絲" ) , 0.101 ) ;
281
281
} ) ;
282
282
} ) ;
283
283
} ) ;
0 commit comments