-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathynabber_test.go
43 lines (36 loc) · 935 Bytes
/
ynabber_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package ynabber
import (
"testing"
)
func TestMilliunitsFromAmount(t *testing.T) {
want := Milliunits(123930)
got := MilliunitsFromAmount(123.93)
if want != got {
t.Fatalf("period separated: %s != %s", want, got)
}
want = Milliunits(4924340)
got = MilliunitsFromAmount(4924.34)
if want != got {
t.Fatalf("comma separated: %s != %s", want, got)
}
want = Milliunits(-2990)
got = MilliunitsFromAmount(-2.99)
if want != got {
t.Fatalf("negative amount: %s != %s", want, got)
}
want = Milliunits(-3899000)
got = MilliunitsFromAmount(-3899)
if want != got {
t.Fatalf("amount with no separator: %s != %s", want, got)
}
want = Milliunits(328180)
got = MilliunitsFromAmount(328.18)
if want != got {
t.Fatalf("amount with no separator: %s != %s", want, got)
}
want = Milliunits(32818000)
got = MilliunitsFromAmount(32818)
if want != got {
t.Fatalf("amount with no separator: %s != %s", want, got)
}
}