(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestDecodeAndEncodeFuzz(t *testing.T) { |
| 122 | mmsa := memsys.PageMM() |
| 123 | b := mmsa.NewSGL(cos.MiB) |
| 124 | defer b.Free() |
| 125 | |
| 126 | for i := 0; i < 10000; i++ { |
| 127 | var ( |
| 128 | x, v string |
| 129 | opts = jsp.Options{Signature: true, Checksum: true} |
| 130 | ) |
| 131 | |
| 132 | x = cos.RandString(i) |
| 133 | |
| 134 | err := jsp.Encode(b, x, opts) |
| 135 | tassert.CheckFatal(t, err) |
| 136 | |
| 137 | _, err = jsp.Decode(b, &v, opts, fmt.Sprintf("%d", i)) |
| 138 | tassert.CheckFatal(t, err) |
| 139 | |
| 140 | tassert.Fatalf(t, x == v, "strings are not equal, (got: %+v, expected: %+v)", x, v) |
| 141 | |
| 142 | b.Reset() |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | func BenchmarkEncode(b *testing.B) { |
| 147 | benches := []struct { |
nothing calls this directly
no test coverage detected