Lines Matching refs:pb_decode
2 #include "pb_decode.c"
205 COMMENT("Testing pb_decode with repeated int32 field")
206 TEST((s = S(""), pb_decode(&s, IntegerArray_fields, &dest) && dest.data_count == 0))
207 TEST((s = S("\x08\x01\x08\x02"), pb_decode(&s, IntegerArray_fields, &dest)
210 TEST(pb_decode(&s, IntegerArray_fields, &dest) && dest.data_count == 10 && dest.data[9] == 10)
212 TEST(!pb_decode(&s, IntegerArray_fields, &dest))
219 COMMENT("Testing pb_decode with packed int32 field")
220 TEST((s = S("\x0A\x00"), pb_decode(&s, IntegerArray_fields, &dest)
222 TEST((s = S("\x0A\x01\x01"), pb_decode(&s, IntegerArray_fields, &dest)
224 TEST((s = S("\x0A\x0A\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A"), pb_decode(&s, IntegerArray_fields, &dest)
226 TEST((s = S("\x0A\x0B\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B"), !pb_decode(&s, IntegerArray_fields, &dest)))
229 TEST((s = S("\x0A\xFF"), !pb_decode(&s, IntegerArray_fields, &dest)))
230 TEST((s = S("\x0A\x01"), !pb_decode(&s, IntegerArray_fields, &dest)))
237 COMMENT("Testing pb_decode with unknown fields")
238 TEST((s = S("\x18\x0F\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest)
240 TEST((s = S("\x19\x00\x00\x00\x00\x00\x00\x00\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest)
242 TEST((s = S("\x1A\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest)
244 TEST((s = S("\x1B\x08\x01"), !pb_decode(&s, IntegerArray_fields, &dest)))
245 TEST((s = S("\x1D\x00\x00\x00\x00\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest)
256 COMMENT("Testing pb_decode with callbacks")
259 TEST((s = S("\x08\x55"), pb_decode(&s, CallbackArray_fields, &dest)))
262 TEST((s = S("\x0A\x03\x55\x55\x55"), pb_decode(&s, CallbackArray_fields, &dest)))
265 TEST((s = S("\x0A\x03\x55\x55\x55"), pb_decode(&s, CallbackArray_fields, &dest)))
268 TEST((s = S("\x0D\xAA\xAA\xAA\xAA"), pb_decode(&s, CallbackArray_fields, &dest)))
271 TEST((s = S("\x09\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"), pb_decode(&s, CallbackArray_fields, &dest)))
273 TEST((s = S("\x0B\x00"), !pb_decode(&s, CallbackArray_fields, &dest)))
277 TEST((s = S("\x08\x55"), !pb_decode(&s, CallbackArray_fields, &dest)))
284 COMMENT("Testing pb_decode message termination")
285 TEST((s = S(""), pb_decode(&s, IntegerArray_fields, &dest)))
286 TEST((s = S("\x00"), pb_decode(&s, IntegerArray_fields, &dest)))
287 TEST((s = S("\x08\x01"), pb_decode(&s, IntegerArray_fields, &dest)))
288 TEST((s = S("\x08\x01\x00"), pb_decode(&s, IntegerArray_fields, &dest)))
289 TEST((s = S("\x08"), !pb_decode(&s, IntegerArray_fields, &dest)))