(f *testing.F)
| 77 | } |
| 78 | |
| 79 | func FuzzRsa(f *testing.F) { |
| 80 | for _, rsaTestInput := range rsaTestData { |
| 81 | f.Add(rsaTestInput.input) |
| 82 | } |
| 83 | f.Fuzz(func(t *testing.T, input string) { |
| 84 | e, d, n := testPrecondition(t) |
| 85 | encrypted, err := Encrypt([]rune(input), e, n) |
| 86 | if err != nil { |
| 87 | t.Fatalf("failed to encrypt string: %v", err) |
| 88 | } |
| 89 | decrypted, err := Decrypt(encrypted, d, n) |
| 90 | if err != nil { |
| 91 | t.Fatalf("failed to decrypt string: %v", err) |
| 92 | } |
| 93 | if decrypted != input { |
| 94 | t.Fatalf("expected: %q, got: %q", input, decrypted) |
| 95 | } |
| 96 | }) |
| 97 | } |
nothing calls this directly
no test coverage detected