TestWriterReader tests that the writer can round-trip with the reader, preserving data while writing every data type.
(t *testing.T)
| 25 | |
| 26 | // TestWriterReader tests that the writer can round-trip with the reader, preserving data while writing every data type. |
| 27 | func TestWriterReader(t *testing.T) { |
| 28 | writer := NewWriter(0) |
| 29 | writer.Bool(false) |
| 30 | writer.Bool(true) |
| 31 | writer.Int8(-128) |
| 32 | writer.Int8(-57) |
| 33 | writer.Int8(0) |
| 34 | writer.Int8(35) |
| 35 | writer.Int8(127) |
| 36 | writer.Int16(-32768) |
| 37 | writer.Int16(-25756) |
| 38 | writer.Int16(0) |
| 39 | writer.Int16(11527) |
| 40 | writer.Int16(32767) |
| 41 | writer.Int32(-2147483648) |
| 42 | writer.Int32(-4764286) |
| 43 | writer.Int32(0) |
| 44 | writer.Int32(17395298) |
| 45 | writer.Int32(2147483647) |
| 46 | writer.Int64(-9223372036854775808) |
| 47 | writer.Int64(-716243597812645) |
| 48 | writer.Int64(0) |
| 49 | writer.Int64(12784331275341) |
| 50 | writer.Int64(9223372036854775807) |
| 51 | writer.Uint8(0) |
| 52 | writer.Uint8(126) |
| 53 | writer.Uint8(255) |
| 54 | writer.Uint16(0) |
| 55 | writer.Uint16(8465) |
| 56 | writer.Uint16(65535) |
| 57 | writer.Uint32(0) |
| 58 | writer.Uint32(217357235) |
| 59 | writer.Uint32(4294967295) |
| 60 | writer.Uint64(0) |
| 61 | writer.Uint64(12465143251276) |
| 62 | writer.Uint64(18446744073709551615) |
| 63 | writer.Float32(-1716.5625) |
| 64 | writer.Float32(0) |
| 65 | writer.Float32(27465) |
| 66 | writer.Float64(-104451.625) |
| 67 | writer.Float64(0) |
| 68 | writer.Float64(26112.40625) |
| 69 | writer.VariableInt(-9223372036854775808) |
| 70 | writer.VariableInt(-716243597812645) |
| 71 | writer.VariableInt(0) |
| 72 | writer.VariableInt(12784331275341) |
| 73 | writer.VariableInt(9223372036854775807) |
| 74 | writer.VariableUint(0) |
| 75 | writer.VariableUint(12465143251276) |
| 76 | writer.VariableUint(18446744073709551615) |
| 77 | writer.String("") |
| 78 | writer.String("abc123") |
| 79 | writer.String("This is a full sentence. 素晴らしい") |
| 80 | writer.BoolSlice([]bool{true, false, false, true}) |
| 81 | writer.Int8Slice([]int8{-128, -57, 0, 35, 127}) |
| 82 | writer.Int16Slice([]int16{-32768, -25756, 0, 11527, 32767}) |
| 83 | writer.Int32Slice([]int32{-2147483648, -4764286, 0, 17395298, 2147483647}) |
| 84 | writer.Int64Slice([]int64{-9223372036854775808, -716243597812645, 0, 12784331275341, 9223372036854775807}) |
nothing calls this directly
no test coverage detected