feat(release): beelloo v0.1
This commit is contained in:
26
internal/invoice/money_test.go
Normal file
26
internal/invoice/money_test.go
Normal file
@ -0,0 +1,26 @@
|
||||
package invoice
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseMoney(t *testing.T) {
|
||||
cases := []struct {
|
||||
input string
|
||||
want Money
|
||||
}{
|
||||
{"1175", 117500},
|
||||
{"1175.5", 117550},
|
||||
{"1175,50", 117550},
|
||||
{"0.01", 1},
|
||||
{"-15", -1500},
|
||||
{"-0.5", -50},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
got, err := ParseMoney(tc.input)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseMoney(%q) unexpected error: %v", tc.input, err)
|
||||
}
|
||||
if got != tc.want {
|
||||
t.Fatalf("ParseMoney(%q)=%v want %v", tc.input, got, tc.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user