Esempio n. 1
0
func TestMoneyValueIntAndFloat(t *testing.T) {
	val := money.Money{M: 123456}

	if val.Valuei() != int64(123456) {
		t.Error("Valuei() should be int64 '123456'", val.Valuei())
	}

	if val.Valuef() != float64(1234.56) {
		t.Error("Valuef() should be float64 '123456'", val.Valuef())
	}

	if val.ValueiTrunc() != int64(1234) {
		t.Error("ValueiTrunc() should be int64 '1234'", val.ValueiTrunc())
	}

	if val.StringD() != "1234.56" {
		t.Error("money struct init StringD() should be value '1234.56'", val.StringD())
	}

	if val.StringC() != "1234,56" {
		t.Error("money struct init StringC() should be value '1234,56'", val.StringC())
	}
}