(t *testing.T)
| 91 | } |
| 92 | |
| 93 | func TestBase64EncodeDecodeInverse(t *testing.T) { |
| 94 | testCases := []struct { |
| 95 | in string |
| 96 | }{ |
| 97 | {"Hello World!"}, // multiple of 3 byte length (multiple of 24-bits) |
| 98 | {"Hello World!a"}, // multiple of 3 byte length + 1 |
| 99 | {"Hello World!ab"}, // multiple of 3 byte length + 2 |
| 100 | {""}, // empty byte slice |
| 101 | {"6"}, // short text |
| 102 | {"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."}, // Long text |
| 103 | } |
| 104 | |
| 105 | for _, tc := range testCases { |
| 106 | result := string(Base64Decode(Base64Encode([]byte(tc.in)))) |
| 107 | if result != tc.in { |
| 108 | t.Fatalf("Base64Decode(Base64Encode(%s)) = %s, want %s", tc.in, result, tc.in) |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | func FuzzBase64Encode(f *testing.F) { |
| 114 | f.Add([]byte("hello")) |
nothing calls this directly
no test coverage detected