This contains maps. Since map order is random, we can expect the encoding order to be random Therefore we cannot use binary compare.
(t *testing.T)
| 682 | // Since map order is random, we can expect the encoding order to be random |
| 683 | // Therefore we cannot use binary compare. |
| 684 | func TestFuzzMapToType(t *testing.T) { |
| 685 | base := &TTestMaps{} |
| 686 | ff := &XTestMaps{} |
| 687 | f := fuzz.New() |
| 688 | f.NumElements(0, 50) |
| 689 | f.NilChance(0.1) |
| 690 | f.Funcs(fuzzTime) |
| 691 | for i := 0; i < 100; i++ { |
| 692 | f.RandSource(rand.New(rand.NewSource(int64(i * 5275)))) |
| 693 | f.Fuzz(base) |
| 694 | ff = &XTestMaps{*base} |
| 695 | |
| 696 | bufbase, err := json.Marshal(base) |
| 697 | require.NoError(t, err, "base[%T] failed to Marshal", base) |
| 698 | |
| 699 | bufff, err := json.Marshal(ff) |
| 700 | require.NoError(t, err, "ff[%T] failed to Marshal", ff) |
| 701 | |
| 702 | var baseD map[string]interface{} |
| 703 | var ffD map[string]interface{} |
| 704 | |
| 705 | err = json.Unmarshal(bufbase, &baseD) |
| 706 | require.NoError(t, err, "ff[%T] failed to Unmarshal", base) |
| 707 | |
| 708 | err = json.Unmarshal(bufff, &ffD) |
| 709 | require.NoError(t, err, "ff[%T] failed to Unmarshal", ff) |
| 710 | |
| 711 | require.Equal(t, baseD, ffD, "Inspected struct difference of base[%T] != ff[%T]", base, ff) |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | func TestFuzzReType(t *testing.T) { |
| 716 | testTypeFuzzN(t, &TReTyped{}, &XReTyped{}, 100) |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…