package utils import ( "joybuywork/internal/consts" "joybuywork/internal/plugins/jsonm" "fmt" "strconv" "strings" "testing" "time" "github.com/golang-module/carbon/v2" ) func TestName(t *testing.T) { var val = "ftg/slot/default_thank_ja.png" idx := strings.LastIndex(val, "/") t.Log(val[:idx+1], val[idx+1:]) } type name struct { A int } type name2 struct { A int } var a = map[string]string{ "1": "1", "2": "2", "3": "3", } func TestD(t *testing.T) { now := carbon.Now().StartOfDay() lastSign := carbon.ParseByFormat("", consts.Ymd) t.Log(lastSign.Lt(now)) } type AS struct { A int `json:"a,omitempty"` } func TestGroups(t *testing.T) { var b = AS{ A: 0, } c, _ := jsonm.Marshal(b) t.Log(string(c)) } func TestMd5(t *testing.T) { t.Log(Md5String(fmt.Sprintf("%v_%v_%v_%v", "223.104.67.190", "Android", "13", "V2203A"))) t.Log(Md5String(fmt.Sprintf("%v_%v_%v_%v", "223.39.212.67", "iOS", "17.4.1", "iPhone"))) } func TestCondTotalFinishNum(t *testing.T) { res := CondTotalFinishNum("13", "12", func(doneNum int32) bool { return doneNum == 2 }) t.Log(res) } func Test3434(t *testing.T) { t1 := fmt.Sprintf("%d", time.Now().Unix()) ts := t1[:len(t1)-1] + "0" ti, _ := strconv.ParseInt(ts, 10, 64) t.Log(t1, ti) }