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