(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestEncryptDecrypt(t *testing.T) { |
| 57 | for _, test := range rsaTestData { |
| 58 | t.Run(test.description, func(t *testing.T) { |
| 59 | e, d, n := testPrecondition(t) |
| 60 | message := []rune(test.input) |
| 61 | encrypted, err := Encrypt(message, e, n) |
| 62 | if err != nil { |
| 63 | t.Fatalf("Failed to Encrypt test string:\n\tDescription: %v\n\tErrMessage: %v", test.description, err) |
| 64 | } |
| 65 | |
| 66 | decrypted, err := Decrypt(encrypted, d, n) |
| 67 | if err != nil { |
| 68 | t.Fatalf("Failed to Decrypt test message:\n\tDescription: %v\n\tErrMessage: %v", test.description, err) |
| 69 | } |
| 70 | |
| 71 | if actual := test.input; actual != decrypted { |
| 72 | t.Logf("FAIL: %s", test.description) |
| 73 | t.Fatalf("Expecting %v, actual %v", decrypted, actual) |
| 74 | } |
| 75 | }) |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | func FuzzRsa(f *testing.F) { |
| 80 | for _, rsaTestInput := range rsaTestData { |
nothing calls this directly
no test coverage detected