Commit ee5ddf34 authored by sunguoshu's avatar sunguoshu

小数测试

parent dad5d355
Pipeline #313 canceled with stages
......@@ -97,3 +97,78 @@ describe('测试整数', () => {
})
})
describe('测试小数', () => {
it('0.01 toBe 壹分', () => {
expect(numberToWords(0.01)).toBe('壹分')
})
it('0.02 toBe 贰分', () => {
expect(numberToWords(0.02)).toBe('贰分')
})
it('0.03 toBe 叁分', () => {
expect(numberToWords(0.03)).toBe('叁分')
})
it('0.04 toBe 肆分', () => {
expect(numberToWords(0.04)).toBe('肆分')
})
it('0.05 toBe 伍分', () => {
expect(numberToWords(0.05)).toBe('伍分')
})
it('0.06 toBe 陆分', () => {
expect(numberToWords(0.06)).toBe('陆分')
})
it('0.07 toBe 柒分', () => {
expect(numberToWords(0.07)).toBe('柒分')
})
it('0.08 toBe 捌分', () => {
expect(numberToWords(0.08)).toBe('捌分')
})
it('0.09 toBe 玖分', () => {
expect(numberToWords(0.09)).toBe('玖分')
})
it('0.10 toBe 壹角', () => {
expect(numberToWords(0.10)).toBe('壹角')
})
it('0.11 toBe 壹角壹分', () => {
expect(numberToWords(0.11)).toBe('壹角壹分')
})
it('0.20 toBe 贰角', () => {
expect(numberToWords(0.20)).toBe('贰角')
})
it('0.55 toBe 伍角伍分', () => {
expect(numberToWords(0.55)).toBe('伍角伍分')
})
it('1.00 toBe 壹元整', () => {
expect(numberToWords(1.00)).toBe('壹元整')
})
it('1.01 toBe 壹元零壹分', () => {
expect(numberToWords(1.01)).toBe('壹元零壹分')
})
it('1.10 toBe 壹元壹角', () => {
expect(numberToWords(1.10)).toBe('壹元壹角')
})
it('1.11 toBe 壹元壹角壹分', () => {
expect(numberToWords(1.11)).toBe('壹元壹角壹分')
})
it('10.00 toBe 壹拾元整', () => {
expect(numberToWords(10.00)).toBe('壹拾元整')
})
})
describe('测试极端小数', () => {
it('1.001 toBe 壹元整', () => {
expect(numberToWords(1.001)).toBe('壹元整')
})
it('1.009 toBe 壹元整', () => {
expect(numberToWords(1.009)).toBe('壹元整')
})
it('1.011 toBe 壹元零壹分', () => {
expect(numberToWords(1.011)).toBe('壹元零壹分')
})
it('0.455', function () {
expect(numberToWords(0.455)).toBe('肆角伍分')
})
it('0.456', function () {
expect(numberToWords(0.456)).toBe('肆角伍分')
})
})
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment