| 24 | } |
| 25 | |
| 26 | func (tc *TestStringTestCase) main() { |
| 27 | c := NewConn(tc.proxy) |
| 28 | defer c.Close() |
| 29 | u := NewUnit(fmt.Sprintf("test_string_tag{%s}", NewZeroTag())) |
| 30 | u.Del(c, false) |
| 31 | r := &Rand{time.Now().UnixNano()} |
| 32 | n := 0 |
| 33 | if step := tc.maxlen / 1000; step != 0 { |
| 34 | buf := make([]byte, step) |
| 35 | for i := 0; i < 1000; i++ { |
| 36 | for j := 0; j < step; j++ { |
| 37 | buf[j] = byte(uint64(r.Next())%(127-32) + 32) |
| 38 | } |
| 39 | u.Append(c, string(buf)) |
| 40 | u.GetString(c) |
| 41 | n += step |
| 42 | ops.Incr() |
| 43 | } |
| 44 | } |
| 45 | for ; n < tc.maxlen; n++ { |
| 46 | u.Append(c, string(byte(uint64(r.Next())%(127-32)+32))) |
| 47 | u.GetString(c) |
| 48 | ops.Incr() |
| 49 | } |
| 50 | u.Del(c, true) |
| 51 | fmt.Println("done") |
| 52 | } |