Skip to content

Commit 95a1293

Browse files
Use assert.strictEqual for tests
1 parent 40ee9ae commit 95a1293

File tree

1 file changed

+38
-38
lines changed

1 file changed

+38
-38
lines changed

test/hanzi2num.test.js

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ var { num2hanzi, hanzi2num, hanzi2numstr } = require("../src/hanzi2num");
44
describe("hanzi2num", () => {
55
describe("num2hanzi(0.53212121222)", () => {
66
it("should translate float number to hanzi correctly", () => {
7-
assert.equal(num2hanzi(0.53212121222), "五分三釐二毫一絲二忽一微二纖一沙二塵二埃二渺");
7+
assert.strictEqual(num2hanzi(0.53212121222), "五分三釐二毫一絲二忽一微二纖一沙二塵二埃二渺");
88
});
99
});
1010

1111
describe("num2hanzi(0.5)", () => {
1212
it("should translate float number to hanzi correctly", () => {
13-
assert.equal(num2hanzi(0.5), "五分");
13+
assert.strictEqual(num2hanzi(0.5), "五分");
1414
});
1515
});
1616

1717
describe("hanzi2num(num2hanzi(0.532))", () => {
1818
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);
2020
});
2121
});
2222

2323
describe('num2hanzi(hanzi2num("二十一京二千三百四十五兆六千七百八十億零九百萬零二百五十有一"))', () => {
2424
it("should translate float number and hanzi back and forth", () => {
25-
assert.equal(
25+
assert.strictEqual(
2626
num2hanzi(
2727
hanzi2num(
2828
"二十一京二千三百四十五兆六千七百八十億零九百萬零二百五十有一"
@@ -35,37 +35,37 @@ describe("hanzi2num", () => {
3535

3636
describe("num2hanzi(-(1e+10 + 99))", () => {
3737
it("should translate small negative float numner to hanzi", () => {
38-
assert.equal(num2hanzi(-(1e+10 + 99)), "負一百億零九十九");
38+
assert.strictEqual(num2hanzi(-(1e+10 + 99)), "負一百億零九十九");
3939
});
4040
});
4141

4242
describe("num2hanzi(0)", () => {
4343
it("should translate 0 to hanzi", () => {
44-
assert.equal(num2hanzi(0), "零");
44+
assert.strictEqual(num2hanzi(0), "零");
4545
});
4646
});
4747

4848
describe("num2hanzi(-0.765433)", () => {
4949
it("should translate negative float number", () => {
50-
assert.equal(num2hanzi(-0.765433), "負七分六釐五毫四絲三忽三微");
50+
assert.strictEqual(num2hanzi(-0.765433), "負七分六釐五毫四絲三忽三微");
5151
});
5252
});
5353

5454
describe('hanzi2num("負一又二分三釐四毫五絲六忽七微")', () => {
5555
it("should translate hanzi to number correctly", () => {
56-
assert.equal(hanzi2num("負一又二分三釐四毫五絲六忽七微"), -1.234567);
56+
assert.strictEqual(hanzi2num("負一又二分三釐四毫五絲六忽七微"), -1.234567);
5757
});
5858
});
5959

6060
describe('hanzi2num("一沙一塵")', () => {
6161
it("should translate hanzi to number correctly", () => {
62-
assert.equal(hanzi2num("一沙一塵"), 1.1e-8);
62+
assert.strictEqual(hanzi2num("一沙一塵"), 1.1e-8);
6363
});
6464
});
6565

6666
describe('hanzi2numstr("二十一京二千三百四十五兆六千七百八十億零九百萬零二百五十有一")', () => {
6767
it("should translate hanzi to number correctly", () => {
68-
assert.equal(
68+
assert.strictEqual(
6969
hanzi2numstr(
7070
"二十一京二千三百四十五兆六千七百八十億零九百萬零二百五十有一"
7171
),
@@ -76,43 +76,43 @@ describe("hanzi2num", () => {
7676

7777
describe('hanzi2numstr("一極零二")', () => {
7878
it("should translate hanzi to number correctly", () => {
79-
assert.equal(
79+
assert.strictEqual(
8080
hanzi2numstr("一極零二"),
8181
"1000000000000000000000000000000000000000000000002");
8282
});
8383
});
8484

8585
describe('hanzi2numstr("一極零二又三漠")', () => {
8686
it("should translate hanzi to number correctly", () => {
87-
assert.equal(
87+
assert.strictEqual(
8888
hanzi2numstr("一極零二又三漠"),
8989
"1000000000000000000000000000000000000000000000002.000000000003");
9090
});
9191
});
9292

9393
describe('hanzi2numstr("一極零二京")', () => {
9494
it("should translate hanzi to number correctly", () => {
95-
assert.equal(
95+
assert.strictEqual(
9696
hanzi2numstr("一極零二京"),
9797
"1.00000000000000000000000000000002e+48");
9898
});
9999
});
100100

101101
describe('hanzi2num("極")', () => {
102102
it("should translate hanzi to number correctly", () => {
103-
assert.equal(hanzi2num("極"), 1e+48);
103+
assert.strictEqual(hanzi2num("極"), 1e+48);
104104
});
105105
});
106106

107107
describe('hanzi2num("三十二又一分")', () => {
108108
it("should translate hanzi to number correctly", () => {
109-
assert.equal(hanzi2num("三十二又一分"), 32.1);
109+
assert.strictEqual(hanzi2num("三十二又一分"), 32.1);
110110
});
111111
});
112112

113113
describe('hanzi2num("二分七釐三毫一絲二忽三微四纖五沙三塵一埃")', () => {
114114
it("should translate hanzi to number correctly", () => {
115-
assert.equal(
115+
assert.strictEqual(
116116
hanzi2num("二分七釐三毫一絲二忽三微四纖五沙三塵一埃"),
117117
0.2731234531
118118
);
@@ -121,103 +121,103 @@ describe("hanzi2num", () => {
121121

122122
describe('hanzi2num("一漠")', () => {
123123
it("should translate hanzi to number correctly", () => {
124-
assert.equal(hanzi2num("一漠"), 1e-12);
124+
assert.strictEqual(hanzi2num("一漠"), 1e-12);
125125
});
126126
});
127127

128128
describe('hanzi2num("三千萬埃")', () => {
129129
it("should translate hanzi to number correctly", () => {
130-
assert.equal(hanzi2num("三千萬埃"), 0.003);
130+
assert.strictEqual(hanzi2num("三千萬埃"), 0.003);
131131
});
132132
});
133133

134134
describe('hanzi2num("三十二")', () => {
135135
it("should translate hanzi to number correctly", () => {
136-
assert.equal(hanzi2num("三十二"), 32);
136+
assert.strictEqual(hanzi2num("三十二"), 32);
137137
});
138138
});
139139

140140
describe('hanzi2num("極極極極極極")', () => {
141141
it("should translate hanzi to number correctly", () => {
142-
assert.equal(hanzi2num("極極極極極極"), 1e288);
142+
assert.strictEqual(hanzi2num("極極極極極極"), 1e288);
143143
});
144144
});
145145

146146
describe('hanzi2num("一萬")', () => {
147147
it("should translate hanzi to number correctly", () => {
148-
assert.equal(hanzi2num("一萬"), 10000);
148+
assert.strictEqual(hanzi2num("一萬"), 10000);
149149
});
150150
});
151151

152152
describe('hanzi2num("零")', () => {
153153
it("should translate hanzi to number correctly", () => {
154-
assert.equal(hanzi2num("零"), 0);
154+
assert.strictEqual(hanzi2num("零"), 0);
155155
});
156156
});
157157

158158
describe('hanzi2num("二百五")', () => {
159159
it("should translate hanzi to number correctly", () => {
160-
assert.equal(hanzi2num("二百五"), 205);
160+
assert.strictEqual(hanzi2num("二百五"), 205);
161161
});
162162
});
163163

164164
describe('hanzi2num("二百零五")', () => {
165165
it("should translate hanzi to number correctly", () => {
166-
assert.equal(hanzi2num("二百零五"), 205);
166+
assert.strictEqual(hanzi2num("二百零五"), 205);
167167
});
168168
});
169169

170170
describe('hanzi2num("三千七")', () => {
171171
it("should translate hanzi to number correctly", () => {
172-
assert.equal(hanzi2num("三千七"), 3007);
172+
assert.strictEqual(hanzi2num("三千七"), 3007);
173173
});
174174
});
175175

176176
describe('hanzi2num("五萬三千七")', () => {
177177
it("should translate hanzi to number correctly", () => {
178-
assert.equal(hanzi2num("五萬三千七"), 53007);
178+
assert.strictEqual(hanzi2num("五萬三千七"), 53007);
179179
});
180180
});
181181

182182
describe('hanzi2num("五萬三千零七")', () => {
183183
it("should translate hanzi to number correctly", () => {
184-
assert.equal(hanzi2num("五萬三千零七"), 53007);
184+
assert.strictEqual(hanzi2num("五萬三千零七"), 53007);
185185
});
186186
});
187187

188188
describe('hanzi2num("十萬")', () => {
189189
it("should translate hanzi to number correctly", () => {
190-
assert.equal(hanzi2num("十萬"), 1e+5);
190+
assert.strictEqual(hanzi2num("十萬"), 1e+5);
191191
});
192192
});
193193

194194
describe('hanzi2num("萬十")', () => {
195195
it("should translate hanzi to number correctly", () => {
196-
assert.equal(hanzi2num("萬十"), 10010);
196+
assert.strictEqual(hanzi2num("萬十"), 10010);
197197
});
198198
});
199199

200200
describe('hanzi2num("萬億")', () => {
201201
it("should translate hanzi to number correctly", () => {
202-
assert.equal(hanzi2num("萬億"), 1e+12);
202+
assert.strictEqual(hanzi2num("萬億"), 1e+12);
203203
});
204204
});
205205

206206
describe('hanzi2num("億萬")', () => {
207207
it("should translate hanzi to number correctly", () => {
208-
assert.equal(hanzi2num("億萬"), 100010000);
208+
assert.strictEqual(hanzi2num("億萬"), 100010000);
209209
});
210210
});
211211

212212
describe('hanzi2num("三·一四一五九二六五三五八九七九三")', () => {
213213
it("should translate hanzi to number correctly", () => {
214-
assert.equal(hanzi2num("三·一四一五九二六五三五八九七九三"), Math.PI);
214+
assert.strictEqual(hanzi2num("三·一四一五九二六五三五八九七九三"), Math.PI);
215215
});
216216
});
217217

218218
describe('hanzi2num("一二京三四五六兆七〇〇〇億")', () => {
219219
it("should translate hanzi to number correctly", () => {
220-
assert.equal(hanzi2num("一二京三四五六兆七〇〇〇億"), 1.234567e+17);
220+
assert.strictEqual(hanzi2num("一二京三四五六兆七〇〇〇億"), 1.234567e+17);
221221
});
222222
});
223223

@@ -229,19 +229,19 @@ describe("hanzi2num", () => {
229229

230230
describe('hanzi2num("一百又五絲")', () => {
231231
it("should translate hanzi to number correctly", () => {
232-
assert.equal(hanzi2num("一百又五絲"), 100.0005);
232+
assert.strictEqual(hanzi2num("一百又五絲"), 100.0005);
233233
});
234234
});
235235

236236
describe('hanzi2num("一百零五絲")', () => {
237237
it("should translate hanzi to number correctly", () => {
238-
assert.equal(hanzi2num("一百零五絲"), 0.0105);
238+
assert.strictEqual(hanzi2num("一百零五絲"), 0.0105);
239239
});
240240
});
241241

242242
describe('hanzi2num("一千又五百")', () => {
243243
it("should translate hanzi to number correctly", () => {
244-
assert.equal(hanzi2num("一千又五百"), 1500);
244+
assert.strictEqual(hanzi2num("一千又五百"), 1500);
245245
});
246246
});
247247

@@ -265,7 +265,7 @@ describe("hanzi2num", () => {
265265

266266
describe('hanzi2num("十分")', () => {
267267
it("should translate hanzi to number correctly", () => {
268-
assert.equal(hanzi2num("十分"), 1);
268+
assert.strictEqual(hanzi2num("十分"), 1);
269269
});
270270
});
271271

@@ -277,7 +277,7 @@ describe("hanzi2num", () => {
277277

278278
describe('hanzi2num("一分十絲")', () => {
279279
it("should translate hanzi to number correctly", () => {
280-
assert.equal(hanzi2num("一分十絲"), 0.101);
280+
assert.strictEqual(hanzi2num("一分十絲"), 0.101);
281281
});
282282
});
283283
});

0 commit comments

Comments
 (0)