good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
b96a59eb
Commit
b96a59eb
authored
Nov 4, 2014
by
Taylor Gerring
Browse files
Options
Downloads
Patches
Plain Diff
Added tests for extra large values
Test “E” scientific notation formatting
parent
e7d9bcd3
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ethutil/common.go
+1
-0
1 addition, 0 deletions
ethutil/common.go
ethutil/common_test.go
+18
-0
18 additions, 0 deletions
ethutil/common_test.go
with
19 additions
and
0 deletions
ethutil/common.go
+
1
−
0
View file @
b96a59eb
...
...
@@ -66,6 +66,7 @@ func CurrencyToString(num *big.Int) string {
denom
=
"Ada"
}
// TODO add comment clarifying expected behavior
if
len
(
fin
.
String
())
>
5
{
return
fmt
.
Sprintf
(
"%sE%d %s"
,
fin
.
String
()[
0
:
5
],
len
(
fin
.
String
())
-
5
,
denom
)
}
...
...
This diff is collapsed.
Click to expand it.
ethutil/common_test.go
+
18
−
0
View file @
b96a59eb
...
...
@@ -79,3 +79,21 @@ func TestCommon(t *testing.T) {
t
.
Error
(
"Got"
,
wei
)
}
}
func
TestLarge
(
t
*
testing
.
T
)
{
douglaslarge
:=
CurrencyToString
(
BigPow
(
100000000
,
43
))
adalarge
:=
CurrencyToString
(
BigPow
(
100000000
,
4
))
weilarge
:=
CurrencyToString
(
big
.
NewInt
(
100000000
))
if
douglaslarge
!=
"10000E298 Douglas"
{
t
.
Error
(
"Got"
,
douglaslarge
)
}
if
adalarge
!=
"10000E7 Einstein"
{
t
.
Error
(
"Got"
,
adalarge
)
}
if
weilarge
!=
"100 Babbage"
{
t
.
Error
(
"Got"
,
weilarge
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment