Lines Matching refs:TEST
50 TEST(pb_read(&stream, buffer2, 6)) in main()
51 TEST(memcmp(buffer2, "foobar", 6) == 0) in main()
52 TEST(stream.bytes_left == sizeof(buffer1) - 6) in main()
53 TEST(pb_read(&stream, buffer2 + 6, stream.bytes_left)) in main()
54 TEST(memcmp(buffer1, buffer2, sizeof(buffer1)) == 0) in main()
55 TEST(stream.bytes_left == 0) in main()
56 TEST(!pb_read(&stream, buffer2, 1)) in main()
64 TEST(pb_read(&stream, buffer, 5)) in main()
65 TEST(memcmp(buffer, "xxxxx", 5) == 0) in main()
66 TEST(!pb_read(&stream, buffer, 50)) in main()
68 TEST(!pb_read(&stream, buffer, 5)) in main()
70 TEST(pb_read(&stream, buffer, 15)) in main()
79 TEST((s = S("\x00"), pb_decode_varint(&s, &u) && u == 0)); in main()
80 TEST((s = S("\x01"), pb_decode_varint(&s, &u) && u == 1)); in main()
81 TEST((s = S("\xAC\x02"), pb_decode_varint(&s, &u) && u == 300)); in main()
82 TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint(&s, &u) && u == UINT32_MAX)); in main()
83 … TEST((s = S("\xFF\xFF\xFF\xFF\x0F"), pb_decode_varint(&s, (uint64_t*)&i) && i == UINT32_MAX)); in main()
84 TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), in main()
86 TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), in main()
93 TEST((s = S("\x00""foobar"), pb_skip_varint(&s) && s.bytes_left == 6)) in main()
94 TEST((s = S("\xAC\x02""foobar"), pb_skip_varint(&s) && s.bytes_left == 6)) in main()
95 TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01""foobar"), in main()
97 TEST((s = S("\xFF"), !pb_skip_varint(&s))) in main()
103 TEST((s = S("\x00""foobar"), pb_skip_string(&s) && s.bytes_left == 6)) in main()
104 TEST((s = S("\x04""testfoobar"), pb_skip_string(&s) && s.bytes_left == 6)) in main()
105 TEST((s = S("\x04"), !pb_skip_string(&s))) in main()
106 TEST((s = S("\xFF"), !pb_skip_string(&s))) in main()
114 TEST(pb_dec_varint(&s, &f, &d) && d == 1) in main()
119 TEST(pb_dec_varint(&s, &f, &d) && (d == 0xFF || d == 0xFF000000)) in main()
128 TEST((s = S("\x01"), pb_dec_svarint(&s, &f, &d) && d == -1)) in main()
129 TEST((s = S("\x02"), pb_dec_svarint(&s, &f, &d) && d == 1)) in main()
130 TEST((s = S("\xfe\xff\xff\xff\x0f"), pb_dec_svarint(&s, &f, &d) && d == INT32_MAX)) in main()
131 TEST((s = S("\xff\xff\xff\xff\x0f"), pb_dec_svarint(&s, &f, &d) && d == INT32_MIN)) in main()
140 TEST((s = S("\x01"), pb_dec_svarint(&s, &f, &d) && d == -1)) in main()
141 TEST((s = S("\x02"), pb_dec_svarint(&s, &f, &d) && d == 1)) in main()
142 …TEST((s = S("\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), pb_dec_svarint(&s, &f, &d) && d == INT64_… in main()
143 …TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), pb_dec_svarint(&s, &f, &d) && d == INT64_… in main()
152 TEST((s = S("\x00\x00\x00\x00"), pb_dec_fixed32(&s, &f, &d) && d == 0.0f)) in main()
153 TEST((s = S("\x00\x00\xc6\x42"), pb_dec_fixed32(&s, &f, &d) && d == 99.0f)) in main()
154 TEST((s = S("\x4e\x61\x3c\xcb"), pb_dec_fixed32(&s, &f, &d) && d == -12345678.0f)) in main()
155 TEST((s = S("\x00"), !pb_dec_fixed32(&s, &f, &d) && d == -12345678.0f)) in main()
164 TEST((s = S("\x00\x00\x00\x00\x00\x00\x00\x00"), pb_dec_fixed64(&s, &f, &d) && d == 0.0)) in main()
165 TEST((s = S("\x00\x00\x00\x00\x00\xc0\x58\x40"), pb_dec_fixed64(&s, &f, &d) && d == 99.0)) in main()
166 … TEST((s = S("\x00\x00\x00\xc0\x29\x8c\x67\xc1"), pb_dec_fixed64(&s, &f, &d) && d == -12345678.0f)) in main()
175 TEST((s = S("\x00"), pb_dec_bytes(&s, &f, &d) && d.size == 0)) in main()
176 TEST((s = S("\x01\xFF"), pb_dec_bytes(&s, &f, &d) && d.size == 1 && d.bytes[0] == 0xFF)) in main()
177 TEST((s = S("\x05xxxxx"), pb_dec_bytes(&s, &f, &d) && d.size == 5)) in main()
178 TEST((s = S("\x05xxxx"), !pb_dec_bytes(&s, &f, &d))) in main()
187 TEST((s = S("\x10xxxxxxxxxx"), !pb_dec_bytes(&s, &f, &d))) in main()
196 TEST((s = S("\x00"), pb_dec_string(&s, &f, &d) && d[0] == '\0')) in main()
197 TEST((s = S("\x04xyzz"), pb_dec_string(&s, &f, &d) && strcmp(d, "xyzz") == 0)) in main()
198 TEST((s = S("\x05xyzzy"), !pb_dec_string(&s, &f, &d))) in main()
206 TEST((s = S(""), pb_decode(&s, IntegerArray_fields, &dest) && dest.data_count == 0)) in main()
207 TEST((s = S("\x08\x01\x08\x02"), pb_decode(&s, IntegerArray_fields, &dest) in main()
210 … TEST(pb_decode(&s, IntegerArray_fields, &dest) && dest.data_count == 10 && dest.data[9] == 10) in main()
212 TEST(!pb_decode(&s, IntegerArray_fields, &dest)) in main()
220 TEST((s = S("\x0A\x00"), pb_decode(&s, IntegerArray_fields, &dest) in main()
222 TEST((s = S("\x0A\x01\x01"), pb_decode(&s, IntegerArray_fields, &dest) in main()
224 …TEST((s = S("\x0A\x0A\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A"), pb_decode(&s, IntegerArray_fields… in main()
226 …TEST((s = S("\x0A\x0B\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"), !pb_decode(&s, IntegerArray_f… in main()
229 TEST((s = S("\x0A\xFF"), !pb_decode(&s, IntegerArray_fields, &dest))) in main()
230 TEST((s = S("\x0A\x01"), !pb_decode(&s, IntegerArray_fields, &dest))) in main()
238 TEST((s = S("\x18\x0F\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest) in main()
240 …TEST((s = S("\x19\x00\x00\x00\x00\x00\x00\x00\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &d… in main()
242 TEST((s = S("\x1A\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest) in main()
244 TEST((s = S("\x1B\x08\x01"), !pb_decode(&s, IntegerArray_fields, &dest))) in main()
245 TEST((s = S("\x1D\x00\x00\x00\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest) in main()
259 TEST((s = S("\x08\x55"), pb_decode(&s, CallbackArray_fields, &dest))) in main()
262 TEST((s = S("\x0A\x03\x55\x55\x55"), pb_decode(&s, CallbackArray_fields, &dest))) in main()
265 TEST((s = S("\x0A\x03\x55\x55\x55"), pb_decode(&s, CallbackArray_fields, &dest))) in main()
268 TEST((s = S("\x0D\xAA\xAA\xAA\xAA"), pb_decode(&s, CallbackArray_fields, &dest))) in main()
271 … TEST((s = S("\x09\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"), pb_decode(&s, CallbackArray_fields, &dest))) in main()
273 TEST((s = S("\x0B\x00"), !pb_decode(&s, CallbackArray_fields, &dest))) in main()
277 TEST((s = S("\x08\x55"), !pb_decode(&s, CallbackArray_fields, &dest))) in main()
285 TEST((s = S(""), pb_decode(&s, IntegerArray_fields, &dest))) in main()
286 TEST((s = S("\x00"), pb_decode(&s, IntegerArray_fields, &dest))) in main()
287 TEST((s = S("\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest))) in main()
288 TEST((s = S("\x08\x01\x00"), pb_decode(&s, IntegerArray_fields, &dest))) in main()
289 TEST((s = S("\x08"), !pb_decode(&s, IntegerArray_fields, &dest))) in main()
297 TEST((s = S("\x09\x0A\x07\x0A\x05\x01\x02\x03\x04\x05"), in main()