Home
last modified time | relevance | path

Searched full:test (Results 1 – 25 of 236) sorted by relevance

12345678910

/nanopb-3.4.0/tests/alltypes/
Ddecode_alltypes.c32 TEST(alltypes.req_int32 == -1001); in check_alltypes()
33 TEST(alltypes.req_int64 == -1002); in check_alltypes()
34 TEST(alltypes.req_uint32 == 1003); in check_alltypes()
35 TEST(alltypes.req_uint64 == 1004); in check_alltypes()
36 TEST(alltypes.req_sint32 == -1005); in check_alltypes()
37 TEST(alltypes.req_sint64 == -1006); in check_alltypes()
38 TEST(alltypes.req_bool == true); in check_alltypes()
40 TEST(alltypes.req_fixed32 == 1008); in check_alltypes()
41 TEST(alltypes.req_sfixed32 == -1009); in check_alltypes()
42 TEST(alltypes.req_float == 1010.0f); in check_alltypes()
[all …]
/nanopb-3.4.0/tests/backwards_compatibility/
Ddecode_legacy.c2 * This is a backwards-compatibility test, using alltypes_legacy.h.
4 * decode_alltypes to test any new features introduced later.
27 TEST(alltypes.req_int32 == -1001); in check_alltypes()
28 TEST(alltypes.req_int64 == -1002); in check_alltypes()
29 TEST(alltypes.req_uint32 == 1003); in check_alltypes()
30 TEST(alltypes.req_uint64 == 1004); in check_alltypes()
31 TEST(alltypes.req_sint32 == -1005); in check_alltypes()
32 TEST(alltypes.req_sint64 == -1006); in check_alltypes()
33 TEST(alltypes.req_bool == true); in check_alltypes()
35 TEST(alltypes.req_fixed32 == 1008); in check_alltypes()
[all …]
/nanopb-3.4.0/tests/without_64bit/
Ddecode_alltypes.c29 TEST(alltypes.req_int32 == -1001); in check_alltypes()
30 TEST(alltypes.req_uint32 == 1003); in check_alltypes()
31 TEST(alltypes.req_sint32 == -1005); in check_alltypes()
32 TEST(alltypes.req_bool == true); in check_alltypes()
34 TEST(alltypes.req_fixed32 == 1008); in check_alltypes()
35 TEST(alltypes.req_sfixed32 == -1009); in check_alltypes()
36 TEST(alltypes.req_float == 1010.0f); in check_alltypes()
38 TEST(strcmp(alltypes.req_string, "1014") == 0); in check_alltypes()
39 TEST(alltypes.req_bytes.size == 4); in check_alltypes()
40 TEST(memcmp(alltypes.req_bytes.bytes, "1015", 4) == 0); in check_alltypes()
[all …]
/nanopb-3.4.0/tests/alltypes_pointer/
Ddecode_alltypes_pointer.c23 TEST(alltypes.req_int32 && *alltypes.req_int32 == -1001); in check_alltypes()
24 TEST(alltypes.req_int64 && *alltypes.req_int64 == -1002); in check_alltypes()
25 TEST(alltypes.req_uint32 && *alltypes.req_uint32 == 1003); in check_alltypes()
26 TEST(alltypes.req_uint64 && *alltypes.req_uint64 == 1004); in check_alltypes()
27 TEST(alltypes.req_sint32 && *alltypes.req_sint32 == -1005); in check_alltypes()
28 TEST(alltypes.req_sint64 && *alltypes.req_sint64 == -1006); in check_alltypes()
29 TEST(alltypes.req_bool && *alltypes.req_bool == true); in check_alltypes()
31 TEST(alltypes.req_fixed32 && *alltypes.req_fixed32 == 1008); in check_alltypes()
32 TEST(alltypes.req_sfixed32 && *alltypes.req_sfixed32 == -1009); in check_alltypes()
33 TEST(alltypes.req_float && *alltypes.req_float == 1010.0f); in check_alltypes()
[all …]
/nanopb-3.4.0/tests/alltypes_proto3/
Ddecode_alltypes.c27TEST(alltypes.rep_int32_count == 5 && alltypes.rep_int32[4] == -2001 && alltypes.rep_int32[0] == 0… in check_alltypes()
28TEST(alltypes.rep_int64_count == 5 && alltypes.rep_int64[4] == -2002 && alltypes.rep_int64[0] == 0… in check_alltypes()
29TEST(alltypes.rep_uint32_count == 5 && alltypes.rep_uint32[4] == 2003 && alltypes.rep_uint32[0] ==… in check_alltypes()
30TEST(alltypes.rep_uint64_count == 5 && alltypes.rep_uint64[4] == 2004 && alltypes.rep_uint64[0] ==… in check_alltypes()
31TEST(alltypes.rep_sint32_count == 5 && alltypes.rep_sint32[4] == -2005 && alltypes.rep_sint32[0] =… in check_alltypes()
32TEST(alltypes.rep_sint64_count == 5 && alltypes.rep_sint64[4] == -2006 && alltypes.rep_sint64[0] =… in check_alltypes()
33TEST(alltypes.rep_bool_count == 5 && alltypes.rep_bool[4] == true && alltypes.rep_bool[0] == false… in check_alltypes()
35TEST(alltypes.rep_fixed32_count == 5 && alltypes.rep_fixed32[4] == 2008 && alltypes.rep_fixed32[0]… in check_alltypes()
36TEST(alltypes.rep_sfixed32_count == 5 && alltypes.rep_sfixed32[4] == -2009 && alltypes.rep_sfixed3… in check_alltypes()
37TEST(alltypes.rep_float_count == 5 && alltypes.rep_float[4] == 2010.0f && alltypes.rep_float[0] ==… in check_alltypes()
[all …]
/nanopb-3.4.0/tests/field_size_16_proto3/
Ddecode_alltypes.c27TEST(alltypes.rep_int32_count == 5 && alltypes.rep_int32[4] == -2001 && alltypes.rep_int32[0] == 0… in check_alltypes()
28TEST(alltypes.rep_int64_count == 5 && alltypes.rep_int64[4] == -2002 && alltypes.rep_int64[0] == 0… in check_alltypes()
29TEST(alltypes.rep_uint32_count == 5 && alltypes.rep_uint32[4] == 2003 && alltypes.rep_uint32[0] ==… in check_alltypes()
30TEST(alltypes.rep_uint64_count == 5 && alltypes.rep_uint64[4] == 2004 && alltypes.rep_uint64[0] ==… in check_alltypes()
31TEST(alltypes.rep_sint32_count == 5 && alltypes.rep_sint32[4] == -2005 && alltypes.rep_sint32[0] =… in check_alltypes()
32TEST(alltypes.rep_sint64_count == 5 && alltypes.rep_sint64[4] == -2006 && alltypes.rep_sint64[0] =… in check_alltypes()
33TEST(alltypes.rep_bool_count == 5 && alltypes.rep_bool[4] == true && alltypes.rep_bool[0] == false… in check_alltypes()
35TEST(alltypes.rep_fixed32_count == 5 && alltypes.rep_fixed32[4] == 2008 && alltypes.rep_fixed32[0]… in check_alltypes()
36TEST(alltypes.rep_sfixed32_count == 5 && alltypes.rep_sfixed32[4] == -2009 && alltypes.rep_sfixed3… in check_alltypes()
37TEST(alltypes.rep_float_count == 5 && alltypes.rep_float[4] == 2010.0f && alltypes.rep_float[0] ==… in check_alltypes()
[all …]
/nanopb-3.4.0/tests/infinity_nan/
Dinfinity_nan_test.c12 TEST(!floats->has_float_pos_inf); in check_floats()
13 TEST(isinf(floats->float_pos_inf)); in check_floats()
14 TEST(!signbit(floats->float_pos_inf)); in check_floats()
16 TEST(!floats->has_float_neg_inf); in check_floats()
17 TEST(isinf(floats->float_neg_inf)); in check_floats()
18 TEST(signbit(floats->float_neg_inf)); in check_floats()
20 TEST(!floats->has_float_pos_nan); in check_floats()
21 TEST(isnan(floats->float_pos_nan)); in check_floats()
23 TEST(!floats->has_float_neg_nan); in check_floats()
24 TEST(isnan(floats->float_neg_nan)); in check_floats()
[all …]
/nanopb-3.4.0/tests/common_unittests/
Dcommon_unittests.c17 COMMENT("Test field iterator logic on AllTypes"); in main()
19 TEST(pb_field_iter_begin(&iter, AllTypes_fields, &msg)) in main()
21 TEST(iter.tag == 1 && iter.pData == &msg.req_int32 && !iter.pSize) in main()
22TEST(pb_field_iter_next(&iter) && iter.tag == 2 && iter.pData == &msg.req_int64 && !iter.pSize) in main()
23TEST(pb_field_iter_next(&iter) && iter.tag == 3 && iter.pData == &msg.req_uint32 && !iter.pSize) in main()
24TEST(pb_field_iter_next(&iter) && iter.tag == 4 && iter.pData == &msg.req_uint64 && !iter.pSize) in main()
25TEST(pb_field_iter_next(&iter) && iter.tag == 5 && iter.pData == &msg.req_sint32 && !iter.pSize) in main()
26TEST(pb_field_iter_next(&iter) && iter.tag == 6 && iter.pData == &msg.req_sint64 && !iter.pSize) in main()
27TEST(pb_field_iter_next(&iter) && iter.tag == 7 && iter.pData == &msg.req_bool && !iter.pSize) in main()
28TEST(pb_field_iter_next(&iter) && iter.tag == 8 && iter.pData == &msg.req_fixed32 && !iter.pSize) in main()
[all …]
/nanopb-3.4.0/tests/encode_unittests/
Dencode_unittests.c58 COMMENT("Test pb_write and pb_ostream_t"); in main()
59 TEST(pb_write(&stream, buffer1, sizeof(buffer1))); in main()
60 TEST(memcmp(buffer1, buffer2, sizeof(buffer1)) == 0); in main()
61 TEST(!pb_write(&stream, buffer1, 1)); in main()
62 TEST(stream.bytes_written == sizeof(buffer1)); in main()
69 COMMENT("Test pb_write with custom callback"); in main()
70 TEST(pb_write(&stream, buffer1, 5)); in main()
72 TEST(!pb_write(&stream, buffer1, 5)); in main()
79 COMMENT("Test pb_encode_varint") in main()
80 TEST(WRITES(pb_encode_varint(&s, 0), "\0")); in main()
[all …]
/nanopb-3.4.0/tests/intsizes/
Dintsizes_unittests.c11 * into the TEST() lines in output */
37 TEST(pb_encode(&s, DefaultSizes_fields, &msg1)); \
43 TEST(pb_decode(&s, IntSizes_fields, &msg2) == expected_result); \
46 TEST( (int64_t)msg2.req_int8 == int8); \
47 TEST((uint64_t)msg2.req_uint8 == uint8); \
48 TEST( (int64_t)msg2.req_sint8 == sint8); \
49 TEST( (int64_t)msg2.req_int16 == int16); \
50 TEST((uint64_t)msg2.req_uint16 == uint16); \
51 TEST( (int64_t)msg2.req_sint16 == sint16); \
52 TEST( (int64_t)msg2.req_int32 == int32); \
[all …]
/nanopb-3.4.0/tests/decode_unittests/
Ddecode_unittests.c51 COMMENT("Test pb_read and pb_istream_t"); in main()
52 TEST(pb_read(&stream, buffer2, 6)) in main()
53 TEST(memcmp(buffer2, "foobar", 6) == 0) in main()
54 TEST(stream.bytes_left == sizeof(buffer1) - 6) in main()
55 TEST(pb_read(&stream, buffer2 + 6, stream.bytes_left)) in main()
56 TEST(memcmp(buffer1, buffer2, sizeof(buffer1)) == 0) in main()
57 TEST(stream.bytes_left == 0) in main()
58 TEST(!pb_read(&stream, buffer2, 1)) in main()
65 COMMENT("Test pb_read with custom callback"); in main()
66 TEST(pb_read(&stream, buffer, 5)) in main()
[all …]
/nanopb-3.4.0/tests/enum_sizes/
Denumsizes_unittests.c27 TEST(pb_encode(&s, UnpackedEnums_fields, &msg1)); in main()
34 TEST(pb_decode(&s, PackedEnums_fields, &msg2)); in main()
36 TEST(msg1.u8_min == (int)msg2.u8_min); in main()
37 TEST(msg1.u8_max == (int)msg2.u8_max); in main()
38 TEST(msg1.i8_min == (int)msg2.i8_min); in main()
39 TEST(msg1.i8_max == (int)msg2.i8_max); in main()
40 TEST(msg1.u16_min == (int)msg2.u16_min); in main()
41 TEST(msg1.u16_max == (int)msg2.u16_max); in main()
42 TEST(msg1.i16_min == (int)msg2.i16_min); in main()
43 TEST(msg1.i16_max == (int)msg2.i16_max); in main()
[all …]
/nanopb-3.4.0/tests/regression/issue_407/
Dtest_extensions.c30 TEST(pb_encode(&stream, SimpleMessage_fields, &msg)); in main()
32 TEST(msglen == 9); /* 3 for number, 3 for submsg tag+len, 3 for second_number */ in main()
33 TEST(buffer[0] == 0x08); /* varint 1 */ in main()
34 TEST(buffer[1] == 0xD2); /* number = 1234 */ in main()
35 TEST(buffer[2] == 0x09); in main()
36 TEST(buffer[3] == 0xE2); /* submsg 1100 */ in main()
37 TEST(buffer[4] == 0x44); in main()
38 TEST(buffer[5] == 0x03); /* length 3 */ in main()
39 TEST(buffer[6] == 0x08); /* varint 1 */ in main()
40 TEST(buffer[7] == 0xae); /* second_number = 5678 */ in main()
[all …]
/nanopb-3.4.0/tests/oneof/
Ddecode_oneof.c11 /* Test the 'OneOfMessage' */
27 TEST(msg.prefix == 123); in test_oneof_1()
28 TEST(msg.suffix == 321); in test_oneof_1()
33 TEST(msg.which_values == OneOfMessage_first_tag); in test_oneof_1()
34 TEST(msg.values.first == 999); in test_oneof_1()
38 TEST(msg.which_values == OneOfMessage_second_tag); in test_oneof_1()
39 TEST(strcmp(msg.values.second, "abcd") == 0); in test_oneof_1()
43 TEST(msg.which_values == OneOfMessage_third_tag); in test_oneof_1()
44 TEST(msg.values.third.array[0] == 1); in test_oneof_1()
45 TEST(msg.values.third.array[1] == 2); in test_oneof_1()
[all …]
/nanopb-3.4.0/tests/inline/
Dinline_unittests.c12 COMMENT("Test inline byte fields"); in main()
16 TEST(sizeof(msg1.data) == 32); in main()
30 TEST(pb_encode(&ostream, Message1_fields, &msg1)); in main()
31 TEST(ostream.bytes_written == Message1_size); in main()
33 TEST(pb_decode(&istream, Message1_fields, &msg1_deserialized)); in main()
35 TEST(istream.bytes_left == 0); in main()
36 TEST(memcmp(&msg1_deserialized, &msg1, sizeof(msg1)) == 0); in main()
51 TEST(pb_encode(&ostream, Message2_fields, &msg2)); in main()
52 TEST(ostream.bytes_written == Message2_size); in main()
54 TEST(pb_decode(&istream, Message2_fields, &msg2_deserialized)); in main()
[all …]
/nanopb-3.4.0/tests/multiple_files/
Dtest_multiple_files.c16 /* Test that included file options are properly loaded */ in main()
17 TEST(OneofMessage_size == 27); in main()
23 TEST(pb_field_iter_begin(&iter, Enums_fields, &msg)); in main()
24 TEST(PB_LTYPE(iter.type) == PB_LTYPE_VARINT); in main()
25 TEST(pb_field_iter_next(&iter)); in main()
26 TEST(PB_LTYPE(iter.type) == PB_LTYPE_UVARINT); in main()
29 /* Test that subdir file is correctly included */ in main()
32 TEST(foo.foo == 15); in main()
33 TEST(subdir_OneofMessage_size >= 27); /* Note: not perfectly accurate due to issue 172 */ in main()
34 TEST(subdir_OneofMessage_size <= 30); in main()
/nanopb-3.4.0/tests/proto3_optional/
Doptional.c12 COMMENT("Test encoding message with optional field") in main()
22 TEST(pb_encode(&stream, TestMessage_fields, &msg)); in main()
26 COMMENT("Test decoding message with optional field") in main()
36 TEST(pb_decode_noinit(&stream, TestMessage_fields, &msg)); in main()
37 TEST(msg.has_opt_int); in main()
38 TEST(msg.opt_int == 99); in main()
39 TEST(msg.normal_int == 100); in main()
40 TEST(!msg.has_opt_int2); in main()
41 TEST(msg.opt_int2 == 5); in main()
42 TEST(msg.normal_int2 == 6); in main()
/nanopb-3.4.0/tests/regression/issue_504/
DSConscript1 # Regression test for #504:
6 env.NanopbProto(["test.proto"])
7 test = malloc_env.Program(["test.c",
8 "test.pb.c",
12 env.RunTest(test)
/nanopb-3.4.0/tests/regression/GHSA-gcx3-7m76-287p/
DSConscript1 # Regression test for security issue GHSA-gcx3-7m76-287p
6 malloc_env.NanopbProto("test")
8 test = malloc_env.Program(["test.c", "test.pb.c",
13 malloc_env.RunTest([test, 'test_input.pb'])
/nanopb-3.4.0/tests/options/
Doptions.c14 COMMENT("Test default_has option"); in main()
17 TEST(msg1.has_present == true); in main()
18 TEST(msg1.has_missing == false); in main()
19 TEST(msg1.has_normal == false); in main()
22 TEST(msg2.has_present == false); in main()
23 TEST(msg2.has_missing == false); in main()
24 TEST(msg2.has_normal == false); in main()
/nanopb-3.4.0/tests/regression/issue_547/
DSConscript1 # Regression test for issue #547:
6 env.NanopbProto("test.proto")
18 # Build and run test
19 test = opts.Program(["test.c", "test.pb.c", "pb_encode_fields32.o", "pb_common_fields32.o"])
21 env.RunTest(test)
/nanopb-3.4.0/tests/fixed_count/
Dfixed_count_unittests.c26 COMMENT("Test encode and decode with three entries"); in main()
29 TEST(pb_encode(&ostream, Message1_fields, &msg_a)); in main()
33 TEST(pb_decode(&istream, Message1_fields, &msg_b)); in main()
35 TEST(istream.bytes_left == 0); in main()
36 TEST(memcmp(&msg_b, &msg_a, sizeof(msg_a)) == 0); in main()
44 COMMENT("Test wrong number of entries"); in main()
47 TEST(pb_decode(&stream, Message1_fields, &msg)); in main()
48 TEST(msg.data[0] == 0 && msg.data[1] == 1 && msg.data[2] == 2); in main()
51 TEST(!pb_decode(&stream, Message1_fields, &msg)); in main()
52 TEST(strcmp(stream.errmsg, "array overflow") == 0); in main()
[all …]
/nanopb-3.4.0/tests/regression/issue_166/
Denum_encoded_size.c17 COMMENT("Test negative value of signed enum"); in main()
21 TEST(pb_encode(&s, SignedMsg_fields, &msg1)); in main()
22 TEST(s.bytes_written == SignedMsg_size); in main()
24 COMMENT("Test positive value of signed enum"); in main()
28 TEST(pb_encode(&s, SignedMsg_fields, &msg1)); in main()
29 TEST(s.bytes_written < SignedMsg_size); in main()
33 COMMENT("Test positive value of unsigned enum"); in main()
37 TEST(pb_encode(&s, UnsignedMsg_fields, &msg2)); in main()
38 TEST(s.bytes_written == UnsignedMsg_size); in main()
/nanopb-3.4.0/tests/regression/issue_195/
DSConscript1 # Regression test for Issue 195: Message size not calculated if a submessage includes
6 env.NanopbProto(["test"])
7 env.Object('test.pb.c')
9 env.Match(['test.pb.h', 'test.expected'])
/nanopb-3.4.0/tests/sort_by_tag/
Dsort_by_tag.c15 COMMENT("Test encoding with unsorted structure"); in main()
17 TEST(&msg.first < &msg.oneof.second); in main()
18 TEST(&msg.oneof.second < &msg.last); in main()
37 COMMENT("Test decoding with sorted structure"); in main()
45 TEST(msg.first == 101); in main()
46 TEST(msg.which_oneof == Sorted_second_tag); in main()
47 TEST(msg.oneof.second == 102); in main()
48 TEST(msg.last == 103); in main()
50 TEST(&msg.first > &msg.oneof.second); in main()
51 TEST(&msg.oneof.second > &msg.last); in main()

12345678910