(f *testing.F)
| 156 | } |
| 157 | |
| 158 | func FuzzCaesar(f *testing.F) { |
| 159 | rnd := rand.New(rand.NewSource(time.Now().UnixNano())) |
| 160 | f.Add("The Quick Brown Fox Jumps over the Lazy Dog.") |
| 161 | f.Fuzz(func(t *testing.T, input string) { |
| 162 | key := rnd.Intn(26) |
| 163 | if result := Decrypt(Encrypt(input, key), key); result != input { |
| 164 | t.Fatalf("With input: '%s' and key: %d\n\tExpected: '%s'\n\tGot: '%s'", input, key, input, result) |
| 165 | } |
| 166 | }) |
| 167 | } |