money_test.go 255 B

1234567891011121314151617
  1. package money
  2. import (
  3. "testing"
  4. )
  5. func TestYuan2Fen(t *testing.T) {
  6. if int(Yuan2Fen(1.2)) != 120 {
  7. t.Fatal("元转换为分错误")
  8. }
  9. }
  10. func TestFen2Yuan(t *testing.T) {
  11. if float32(Fen2Yuan(120)) != 1.2 {
  12. t.Fatal("分转换为元错误")
  13. }
  14. }