| 85 | } |
| 86 | |
| 87 | func TestDecodeMap(t *testing.T) { |
| 88 | for _, tc := range mapDecodeTestCases { |
| 89 | buf := bytes.NewBuffer([]byte{}) |
| 90 | map2Json(getReader(string(tc.Bin)), buf) |
| 91 | if buf.String() != tc.Json { |
| 92 | t.Errorf("map2Json(0x%s)=%s, want: %s", hex.EncodeToString(tc.Bin), buf.String(), tc.Json) |
| 93 | } |
| 94 | } |
| 95 | for _, tc := range infiniteMapDecodeTestCases { |
| 96 | buf := bytes.NewBuffer([]byte{}) |
| 97 | map2Json(getReader(string(tc.Bin)), buf) |
| 98 | if buf.String() != tc.Json { |
| 99 | t.Errorf("map2Json(0x%s)=%s, want: %s", hex.EncodeToString(tc.Bin), buf.String(), tc.Json) |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | func TestDecodeBool(t *testing.T) { |
| 105 | for _, tc := range internal.BooleanTestCases { |