gitee.com/zhongguo168a/gocodes@v0.0.0-20230609140523-e1828349603f/myx/identx/ident_test.go (about) 1 package identx 2 3 import ( 4 "fmt" 5 "gitee.com/zhongguo168a/gocodes/myx/scale" 6 "sync" 7 "testing" 8 "time" 9 ) 10 11 func TestGenOne(t *testing.T) { 12 m := map[string]bool{} 13 for i := 0; i < 655; i++ { 14 a := GenOne() 15 if m[a] { 16 fmt.Println(a) 17 } 18 m[a] = true 19 fmt.Println("a", a) 20 //ParseTime(a) 21 } 22 } 23 24 func TestGenOneGo(t *testing.T) { 25 m := &sync.Map{} 26 for j := 0; j < 100000; j++ { 27 go func() { 28 for i := 0; i < 1000; i++ { 29 a := GenOne() 30 if _, ok := m.Load(a); ok { 31 fmt.Println("test same", a) 32 } 33 m.Store(a, true) 34 //ParseTime(a) 35 //time.Sleep(time.Millisecond) 36 } 37 }() 38 } 39 40 } 41 42 func TestGenOther(t *testing.T) { 43 num := int(time.Now().Unix()) 44 fmt.Println(scale.DecimalTo(num, 62)) 45 }