常用类型及数据操作方法
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
635 B

3 years ago
  1. package helper
  2. import (
  3. "strings"
  4. "testing"
  5. )
  6. func Test_FloadAdd(t *testing.T) {
  7. // str1 := 4
  8. str2 := "5"
  9. str3 := 6.5
  10. // str4 := 1
  11. ret := FloatAdd(str3, str2)
  12. t.Log(ret)
  13. percentage := "8:2:1"
  14. price := strings.Split(percentage, ":")
  15. ret = FloatAdd(price[0], price[1], price[2])
  16. t.Log(ret)
  17. }
  18. func Test_FloatSub(t *testing.T) {
  19. str1 := 4.25
  20. str2 := "5.33"
  21. ret := FloatSub(str1, str2)
  22. t.Log(ret)
  23. }
  24. func Test_FloatMul(t *testing.T) {
  25. str1 := 4.25
  26. str2 := "5.33"
  27. ret := FloatMul(str1, str2, 1)
  28. t.Log(ret)
  29. }
  30. func Test_FloatQuo(t *testing.T) {
  31. str1 := 6
  32. str2 := "7"
  33. ret := FloatQuo(str1, str2, 3)
  34. t.Log(ret)
  35. }