init
This commit is contained in:
commit
ef105e1cac
22 changed files with 3001 additions and 0 deletions
31
internal/platform/money_test.go
Normal file
31
internal/platform/money_test.go
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package platform
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestParseCZK(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
want int64
|
||||
}{
|
||||
{input: "100", want: 10000},
|
||||
{input: "100.50", want: 10050},
|
||||
{input: "100,5", want: 10050},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
got, err := ParseCZK(tt.input)
|
||||
if err != nil {
|
||||
t.Fatalf("ParseCZK(%q) returned error: %v", tt.input, err)
|
||||
}
|
||||
if got != tt.want {
|
||||
t.Fatalf("ParseCZK(%q) = %d, want %d", tt.input, got, tt.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestFormatCZK(t *testing.T) {
|
||||
got := FormatCZK(1234567)
|
||||
if got != "12 345,67 CZK" {
|
||||
t.Fatalf("FormatCZK() = %q", got)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue