gitee.com/sy_183/go-common@v1.0.5-0.20231205030221-958cfe129b47/flag/flag_test.go (about) 1 package flag 2 3 import ( 4 "fmt" 5 "math" 6 "testing" 7 "time" 8 ) 9 10 func TestFlagMask(t *testing.T) { 11 start := time.Now() 12 for i := 0; i < math.MaxInt; i++ { 13 if TestFlag(i, 0x1000000000000000) { 14 return 15 } 16 //_ = i | 0x100011101 17 //_ = i | 0x100011101 18 //_ = i | 0x100011101 19 //_ = i | 0x100011101 20 //_ = i | 0x100011101 21 //_ = i | 0x100011101 22 //_ = i | 0x100011101 23 //_ = i | 0x100011101 24 //_ = i | 0x100011101 25 //_ = i | 0x100011101 26 if i%100000000 == 0 { 27 d := time.Now().Sub(start) 28 speed := float64(i) / d.Seconds() 29 fmt.Printf("%10f\n", speed) 30 } 31 } 32 }