Lines Matching refs:f

131         pb_field_iter_t f;  in main()  local
134 f.type = PB_LTYPE_VARINT; in main()
135 f.data_size = sizeof(d); in main()
136 f.pData = &d; in main()
139 TEST(pb_dec_varint(&s, &f) && d == 1) in main()
143 f.data_size = 1; in main()
144 TEST(pb_dec_varint(&s, &f) && (d == 0xFFFFFF00 || d == 0x00FFFFFF)) in main()
149 pb_field_iter_t f; in main() local
152 f.type = PB_LTYPE_SVARINT; in main()
153 f.data_size = sizeof(d); in main()
154 f.pData = &d; in main()
157 TEST((s = S("\x01"), pb_dec_varint(&s, &f) && d == -1)) in main()
158 TEST((s = S("\x02"), pb_dec_varint(&s, &f) && d == 1)) in main()
159 TEST((s = S("\xfe\xff\xff\xff\x0f"), pb_dec_varint(&s, &f) && d == INT32_MAX)) in main()
160 TEST((s = S("\xff\xff\xff\xff\x0f"), pb_dec_varint(&s, &f) && d == INT32_MIN)) in main()
165 pb_field_iter_t f; in main() local
168 f.type = PB_LTYPE_SVARINT; in main()
169 f.data_size = sizeof(d); in main()
170 f.pData = &d; in main()
173 TEST((s = S("\x01"), pb_dec_varint(&s, &f) && d == -1)) in main()
174 TEST((s = S("\x02"), pb_dec_varint(&s, &f) && d == 1)) in main()
175 … TEST((s = S("\xFE\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), pb_dec_varint(&s, &f) && d == INT64_MAX)) in main()
176 … TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), pb_dec_varint(&s, &f) && d == INT64_MIN)) in main()
181 pb_field_iter_t f; in main() local
184 f.type = PB_LTYPE_SVARINT; in main()
185 f.data_size = sizeof(d); in main()
186 f.pData = &d; in main()
189 TEST((s = S("\xfe\xff\xff\xff\x0f"), pb_dec_varint(&s, &f))); in main()
190 TEST((s = S("\xfe\xff\xff\xff\x10"), !pb_dec_varint(&s, &f))); in main()
191 TEST((s = S("\xff\xff\xff\xff\x0f"), pb_dec_varint(&s, &f))); in main()
192 TEST((s = S("\xff\xff\xff\xff\x10"), !pb_dec_varint(&s, &f))); in main()
197 pb_field_iter_t f; in main() local
200 f.type = PB_LTYPE_UVARINT; in main()
201 f.data_size = sizeof(d); in main()
202 f.pData = &d; in main()
205 TEST((s = S("\x01"), pb_dec_varint(&s, &f) && d == 1)) in main()
206 TEST((s = S("\x02"), pb_dec_varint(&s, &f) && d == 2)) in main()
207 TEST((s = S("\xff\xff\xff\xff\x0f"), pb_dec_varint(&s, &f) && d == UINT32_MAX)) in main()
212 pb_field_iter_t f; in main() local
215 f.type = PB_LTYPE_UVARINT; in main()
216 f.data_size = sizeof(d); in main()
217 f.pData = &d; in main()
220 TEST((s = S("\x01"), pb_dec_varint(&s, &f) && d == 1)) in main()
221 TEST((s = S("\x02"), pb_dec_varint(&s, &f) && d == 2)) in main()
222 …TEST((s = S("\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\x01"), pb_dec_varint(&s, &f) && d == UINT64_MAX)) in main()
227 pb_field_iter_t f; in main() local
230 f.type = PB_LTYPE_UVARINT; in main()
231 f.data_size = sizeof(d); in main()
232 f.pData = &d; in main()
235 TEST((s = S("\xff\xff\xff\xff\x0f"), pb_dec_varint(&s, &f))); in main()
236 TEST((s = S("\xff\xff\xff\xff\x10"), !pb_dec_varint(&s, &f))); in main()
265 pb_field_iter_t f; in main() local
267 f.type = PB_LTYPE_BYTES; in main()
268 f.data_size = sizeof(d); in main()
269 f.pData = &d; in main()
272 TEST((s = S("\x00"), pb_dec_bytes(&s, &f) && d.size == 0)) in main()
273 TEST((s = S("\x01\xFF"), pb_dec_bytes(&s, &f) && d.size == 1 && d.bytes[0] == 0xFF)) in main()
274 TEST((s = S("\x05xxxxx"), pb_dec_bytes(&s, &f) && d.size == 5)) in main()
275 TEST((s = S("\x05xxxx"), !pb_dec_bytes(&s, &f))) in main()
284 TEST((s = S("\x10xxxxxxxxxx"), !pb_dec_bytes(&s, &f))) in main()
289 pb_field_iter_t f; in main() local
292 f.type = PB_LTYPE_STRING; in main()
293 f.data_size = sizeof(d); in main()
294 f.pData = &d; in main()
297 TEST((s = S("\x00"), pb_dec_string(&s, &f) && d[0] == '\0')) in main()
298 TEST((s = S("\x04xyzz"), pb_dec_string(&s, &f) && strcmp(d, "xyzz") == 0)) in main()
299 TEST((s = S("\x05xyzzy"), !pb_dec_string(&s, &f))) in main()