MCPcopy Index your code
hub / github.com/tailscale/tailscale / FuzzTime

Function FuzzTime

util/deephash/deephash_test.go:860–903  ·  view source on GitHub ↗
(f *testing.F)

Source from the content-addressed store, hash-verified

858}
859
860func FuzzTime(f *testing.F) {
861 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(0), false, "", 0)
862 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(0), true, "", 0)
863 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(0), true, "hello", 0)
864 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(0), true, "", 1234)
865 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(0), true, "hello", 1234)
866
867 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(1), false, "", 0)
868 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(1), true, "", 0)
869 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(1), true, "hello", 0)
870 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(1), true, "", 1234)
871 f.Add(int64(0), int64(0), false, "", 0, int64(0), int64(1), true, "hello", 1234)
872
873 f.Add(int64(math.MaxInt64), int64(math.MaxInt64), false, "", 0, int64(math.MaxInt64), int64(math.MaxInt64), false, "", 0)
874 f.Add(int64(math.MaxInt64), int64(math.MaxInt64), false, "", 0, int64(math.MaxInt64), int64(math.MaxInt64), true, "", 0)
875 f.Add(int64(math.MaxInt64), int64(math.MaxInt64), false, "", 0, int64(math.MaxInt64), int64(math.MaxInt64), true, "hello", 0)
876 f.Add(int64(math.MaxInt64), int64(math.MaxInt64), false, "", 0, int64(math.MaxInt64), int64(math.MaxInt64), true, "", 1234)
877 f.Add(int64(math.MaxInt64), int64(math.MaxInt64), false, "", 0, int64(math.MaxInt64), int64(math.MaxInt64), true, "hello", 1234)
878
879 f.Add(int64(math.MinInt64), int64(math.MinInt64), false, "", 0, int64(math.MinInt64), int64(math.MinInt64), false, "", 0)
880 f.Add(int64(math.MinInt64), int64(math.MinInt64), false, "", 0, int64(math.MinInt64), int64(math.MinInt64), true, "", 0)
881 f.Add(int64(math.MinInt64), int64(math.MinInt64), false, "", 0, int64(math.MinInt64), int64(math.MinInt64), true, "hello", 0)
882 f.Add(int64(math.MinInt64), int64(math.MinInt64), false, "", 0, int64(math.MinInt64), int64(math.MinInt64), true, "", 1234)
883 f.Add(int64(math.MinInt64), int64(math.MinInt64), false, "", 0, int64(math.MinInt64), int64(math.MinInt64), true, "hello", 1234)
884
885 f.Fuzz(func(t *testing.T,
886 s1, ns1 int64, loc1 bool, name1 string, off1 int,
887 s2, ns2 int64, loc2 bool, name2 string, off2 int,
888 ) {
889 t1 := time.Unix(s1, ns1)
890 if loc1 {
891 _ = t1.In(time.FixedZone(name1, off1))
892 }
893 t2 := time.Unix(s2, ns2)
894 if loc2 {
895 _ = t2.In(time.FixedZone(name2, off2))
896 }
897 got := Hash(&t1) == Hash(&t2)
898 want := t1.Format(time.RFC3339Nano) == t2.Format(time.RFC3339Nano)
899 if got != want {
900 t.Errorf("time.Time(%s) == time.Time(%s) mismatches hash equivalent", t1.Format(time.RFC3339Nano), t2.Format(time.RFC3339Nano))
901 }
902 })
903}
904
905func FuzzAddr(f *testing.F) {
906 f.Fuzz(func(t *testing.T,

Callers

nothing calls this directly

Calls 4

HashFunction · 0.85
AddMethod · 0.65
ErrorfMethod · 0.65
FormatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…