Files
beelloo/internal/invoice/money_test.go
2026-02-11 11:13:26 +01:00

27 lines
490 B
Go

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)
}
}
}