Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
fe-utils
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sunguoshu
fe-utils
Commits
ee5ddf34
Commit
ee5ddf34
authored
Jul 17, 2023
by
sunguoshu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小数测试
parent
dad5d355
Pipeline
#313
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
numberToWords.test.ts
test/money/numberToWords.test.ts
+75
-0
No files found.
test/money/numberToWords.test.ts
View file @
ee5ddf34
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment