(t *testing.T)
| 112 | } |
| 113 | |
| 114 | func TestReadJSONProtocolByte(t *testing.T) { |
| 115 | thetype := "byte" |
| 116 | for _, value := range BYTE_VALUES { |
| 117 | trans := NewTMemoryBuffer() |
| 118 | p := NewTJSONProtocol(trans) |
| 119 | trans.WriteString(strconv.Itoa(int(value))) |
| 120 | trans.Flush(context.Background()) |
| 121 | s := trans.String() |
| 122 | v, e := p.ReadByte(context.Background()) |
| 123 | if e != nil { |
| 124 | t.Fatalf("Unable to read %s value %v due to error: %s", thetype, value, e.Error()) |
| 125 | } |
| 126 | if v != value { |
| 127 | t.Fatalf("Bad value for %s value %v, wrote: %v, received: %v", thetype, value, s, v) |
| 128 | } |
| 129 | if err := json.Unmarshal([]byte(s), &v); err != nil || v != value { |
| 130 | t.Fatalf("Bad json-decoded value for %s %v, wrote: '%s', expected: '%v'", thetype, value, s, v) |
| 131 | } |
| 132 | trans.Reset() |
| 133 | trans.Close() |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | func TestWriteJSONProtocolI16(t *testing.T) { |
| 138 | thetype := "int16" |
nothing calls this directly
no test coverage detected