MCPcopy
hub / github.com/TheAlgorithms/Go / FuzzCaesar

Function FuzzCaesar

cipher/caesar/caesar_test.go:158–167  ·  view source on GitHub ↗
(f *testing.F)

Source from the content-addressed store, hash-verified

156}
157
158func 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}

Callers

nothing calls this directly

Calls 3

DecryptFunction · 0.70
EncryptFunction · 0.70
AddMethod · 0.65

Tested by

no test coverage detected