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.

37 lines
836 B

package convert
import (
"fmt"
"testing"
)
func TestConv_StrToInt(t *testing.T) {
fmt.Println(conv.StrToInt("345"))
fmt.Println(conv.StrToInt("3r45"))
fmt.Println(conv.StrToInt("3r45", 45))
}
func TestConv_StrToInt64(t *testing.T) {
fmt.Println(conv.StrToInt64("34567"))
fmt.Println(conv.StrToInt64("34ttt567"))
fmt.Println(conv.StrToInt64("34ttt567", 789))
}
func TestConv_StrToBool(t *testing.T) {
fmt.Println(conv.StrToBool("true"))
fmt.Println(conv.StrToBool("false"))
fmt.Println(conv.StrToBool("true1"))
fmt.Println(conv.StrToBool("false2"))
fmt.Println(conv.StrToBool("0"))
fmt.Println(conv.StrToBool("1"))
fmt.Println(conv.StrToBool("2"))
fmt.Println(conv.StrToBool("3"))
}
func TestConv_StrToSlice(t *testing.T) {
fmt.Println(conv.StrToSlice("1,2,3,4,5"))
fmt.Println(conv.StrToSlice("hello,world"))
}