| 102 | } |
| 103 | |
| 104 | func TestEncodeDoubleMaskEdge(t *testing.T) { |
| 105 | for i, tc := range testCasesDoubleEdge { |
| 106 | e := tc.mask |
| 107 | t.Run(strconv.FormatInt(int64(i), 10), func(t *testing.T) { |
| 108 | got := e.Encode(tc.in) |
| 109 | if got != tc.out { |
| 110 | t.Errorf("Encode(%q) want %q got %q", tc.in, tc.out, got) |
| 111 | } |
| 112 | got2 := e.Decode(got) |
| 113 | if got2 != tc.in { |
| 114 | t.Errorf("Decode(%q) want %q got %q", got, tc.in, got2) |
| 115 | } |
| 116 | }) |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | func TestEncodeInvalidUnicode(t *testing.T) { |
| 121 | for i, tc := range []testCase{ |