常用类型及数据操作方法
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.
 

59 lines
913 B

package helper
import (
"math"
"strings"
"testing"
)
func Test_FloadAdd(t *testing.T) {
// str1 := 4
str2 := "5"
str3 := 6.5
// str4 := 1
ret := FloatAdd(str3, str2)
t.Log(ret)
percentage := "8:2:1"
price := strings.Split(percentage, ":")
ret = FloatAdd(price[0], price[1], price[2])
t.Log(ret)
}
func Test_FloatSub(t *testing.T) {
str1 := 4.25
str2 := "5.33"
ret := FloatSub(str1, str2)
t.Log(ret)
}
func Test_FloatMul(t *testing.T) {
str1 := 4.25
str2 := "5.33"
ret := FloatMul(str1, str2, 1)
t.Log(ret)
}
func Test_FloatQuo(t *testing.T) {
str1 := 6
str2 := "7"
ret := FloatQuo(str1, str2, 3)
t.Log(ret)
ret = math.Ceil(FloatQuo(4500, 3600))
t.Log(ret)
}
// func Test_TenToHex(t *testing.T) {
// str1 := 10664
// ret := TenToHex(str1)
// t.Log(ret)
// }
// func Test_HexToTen(t *testing.T) {
// str := "29B79F0D"
// ret, err := HexToTen(str)
// t.Log(ret, err)
// }