(t *testing.T)
| 276 | } |
| 277 | |
| 278 | func TestFromStringQuick(t *testing.T) { |
| 279 | f := func(id1 ID, c byte) bool { |
| 280 | s1 := id1.String() |
| 281 | for i := range s1 { |
| 282 | s2 := []byte(s1) |
| 283 | s2[i] = c |
| 284 | id2, err := FromString(string(s2)) |
| 285 | if id1 == id2 && err == nil && c != s1[i] { |
| 286 | t.Logf("comparing XIDs:\na: %q\nb: %q (index %d changed to %c)", s1, s2, i, c) |
| 287 | return false |
| 288 | } |
| 289 | } |
| 290 | return true |
| 291 | } |
| 292 | err := quick.Check(f, &quick.Config{ |
| 293 | Values: func(args []reflect.Value, r *rand.Rand) { |
| 294 | i := r.Intn(len(encoding)) |
| 295 | args[0] = reflect.ValueOf(New()) |
| 296 | args[1] = reflect.ValueOf(byte(encoding[i])) |
| 297 | }, |
| 298 | MaxCount: 1000, |
| 299 | }) |
| 300 | if err != nil { |
| 301 | t.Error(err) |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | func TestFromStringQuickInvalidChars(t *testing.T) { |
| 306 | f := func(id1 ID, c byte) bool { |
nothing calls this directly
no test coverage detected
searching dependent graphs…