summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-10-14 12:27:08 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-10-14 12:27:08 +0300
commit900c8dd1252afe2b2474b852ae48dcb46e100505 (patch)
treec843674be135cd1bafacc7fe65d7a2219fcee8d1
parent3f563792adb8448a55c3b4f16f11a3b0d37dac37 (diff)
Add tests for negative values in the alltypes testcase.
-rw-r--r--tests/test_decode3.c24
-rw-r--r--tests/test_encode3.c24
2 files changed, 24 insertions, 24 deletions
diff --git a/tests/test_decode3.c b/tests/test_decode3.c
index 4b7ee9e2..cd1b154b 100644
--- a/tests/test_decode3.c
+++ b/tests/test_decode3.c
@@ -26,20 +26,20 @@ bool check_alltypes(pb_istream_t *stream, int mode)
if (!pb_decode(stream, AllTypes_fields, &alltypes))
return false;
- TEST(alltypes.req_int32 == 1001);
- TEST(alltypes.req_int64 == 1002);
+ TEST(alltypes.req_int32 == -1001);
+ TEST(alltypes.req_int64 == -1002);
TEST(alltypes.req_uint32 == 1003);
TEST(alltypes.req_uint64 == 1004);
- TEST(alltypes.req_sint32 == 1005);
- TEST(alltypes.req_sint64 == 1006);
+ TEST(alltypes.req_sint32 == -1005);
+ TEST(alltypes.req_sint64 == -1006);
TEST(alltypes.req_bool == true);
TEST(alltypes.req_fixed32 == 1008);
- TEST(alltypes.req_sfixed32 == 1009);
+ TEST(alltypes.req_sfixed32 == -1009);
TEST(alltypes.req_float == 1010.0f);
TEST(alltypes.req_fixed64 == 1011);
- TEST(alltypes.req_sfixed64 == 1012);
+ TEST(alltypes.req_sfixed64 == -1012);
TEST(alltypes.req_double == 1013.0f);
TEST(strcmp(alltypes.req_string, "1014") == 0);
@@ -50,20 +50,20 @@ bool check_alltypes(pb_istream_t *stream, int mode)
TEST(alltypes.req_submsg.substuff3 == 3);
TEST(alltypes.req_enum == MyEnum_Truth);
- TEST(alltypes.rep_int32_count == 5 && alltypes.rep_int32[4] == 2001 && alltypes.rep_int32[0] == 0);
- TEST(alltypes.rep_int64_count == 5 && alltypes.rep_int64[4] == 2002 && alltypes.rep_int64[0] == 0);
+ TEST(alltypes.rep_int32_count == 5 && alltypes.rep_int32[4] == -2001 && alltypes.rep_int32[0] == 0);
+ TEST(alltypes.rep_int64_count == 5 && alltypes.rep_int64[4] == -2002 && alltypes.rep_int64[0] == 0);
TEST(alltypes.rep_uint32_count == 5 && alltypes.rep_uint32[4] == 2003 && alltypes.rep_uint32[0] == 0);
TEST(alltypes.rep_uint64_count == 5 && alltypes.rep_uint64[4] == 2004 && alltypes.rep_uint64[0] == 0);
- TEST(alltypes.rep_sint32_count == 5 && alltypes.rep_sint32[4] == 2005 && alltypes.rep_sint32[0] == 0);
- TEST(alltypes.rep_sint64_count == 5 && alltypes.rep_sint64[4] == 2006 && alltypes.rep_sint64[0] == 0);
+ TEST(alltypes.rep_sint32_count == 5 && alltypes.rep_sint32[4] == -2005 && alltypes.rep_sint32[0] == 0);
+ TEST(alltypes.rep_sint64_count == 5 && alltypes.rep_sint64[4] == -2006 && alltypes.rep_sint64[0] == 0);
TEST(alltypes.rep_bool_count == 5 && alltypes.rep_bool[4] == true && alltypes.rep_bool[0] == false);
TEST(alltypes.rep_fixed32_count == 5 && alltypes.rep_fixed32[4] == 2008 && alltypes.rep_fixed32[0] == 0);
- TEST(alltypes.rep_sfixed32_count == 5 && alltypes.rep_sfixed32[4] == 2009 && alltypes.rep_sfixed32[0] == 0);
+ TEST(alltypes.rep_sfixed32_count == 5 && alltypes.rep_sfixed32[4] == -2009 && alltypes.rep_sfixed32[0] == 0);
TEST(alltypes.rep_float_count == 5 && alltypes.rep_float[4] == 2010.0f && alltypes.rep_float[0] == 0.0f);
TEST(alltypes.rep_fixed64_count == 5 && alltypes.rep_fixed64[4] == 2011 && alltypes.rep_fixed64[0] == 0);
- TEST(alltypes.rep_sfixed64_count == 5 && alltypes.rep_sfixed64[4] == 2012 && alltypes.rep_sfixed64[0] == 0);
+ TEST(alltypes.rep_sfixed64_count == 5 && alltypes.rep_sfixed64[4] == -2012 && alltypes.rep_sfixed64[0] == 0);
TEST(alltypes.rep_double_count == 5 && alltypes.rep_double[4] == 2013.0 && alltypes.rep_double[0] == 0.0);
TEST(alltypes.rep_string_count == 5 && strcmp(alltypes.rep_string[4], "2014") == 0 && alltypes.rep_string[0][0] == '\0');
diff --git a/tests/test_encode3.c b/tests/test_encode3.c
index 1a48f06b..6db37fdc 100644
--- a/tests/test_encode3.c
+++ b/tests/test_encode3.c
@@ -14,20 +14,20 @@ int main(int argc, char **argv)
/* Initialize the structure with constants */
AllTypes alltypes = {0};
- alltypes.req_int32 = 1001;
- alltypes.req_int64 = 1002;
+ alltypes.req_int32 = -1001;
+ alltypes.req_int64 = -1002;
alltypes.req_uint32 = 1003;
alltypes.req_uint64 = 1004;
- alltypes.req_sint32 = 1005;
- alltypes.req_sint64 = 1006;
+ alltypes.req_sint32 = -1005;
+ alltypes.req_sint64 = -1006;
alltypes.req_bool = true;
alltypes.req_fixed32 = 1008;
- alltypes.req_sfixed32 = 1009;
+ alltypes.req_sfixed32 = -1009;
alltypes.req_float = 1010.0f;
alltypes.req_fixed64 = 1011;
- alltypes.req_sfixed64 = 1012;
+ alltypes.req_sfixed64 = -1012;
alltypes.req_double = 1013.0;
strcpy(alltypes.req_string, "1014");
@@ -37,20 +37,20 @@ int main(int argc, char **argv)
alltypes.req_submsg.substuff2 = 1016;
alltypes.req_enum = MyEnum_Truth;
- alltypes.rep_int32_count = 5; alltypes.rep_int32[4] = 2001;
- alltypes.rep_int64_count = 5; alltypes.rep_int64[4] = 2002;
+ alltypes.rep_int32_count = 5; alltypes.rep_int32[4] = -2001;
+ alltypes.rep_int64_count = 5; alltypes.rep_int64[4] = -2002;
alltypes.rep_uint32_count = 5; alltypes.rep_uint32[4] = 2003;
alltypes.rep_uint64_count = 5; alltypes.rep_uint64[4] = 2004;
- alltypes.rep_sint32_count = 5; alltypes.rep_sint32[4] = 2005;
- alltypes.rep_sint64_count = 5; alltypes.rep_sint64[4] = 2006;
+ alltypes.rep_sint32_count = 5; alltypes.rep_sint32[4] = -2005;
+ alltypes.rep_sint64_count = 5; alltypes.rep_sint64[4] = -2006;
alltypes.rep_bool_count = 5; alltypes.rep_bool[4] = true;
alltypes.rep_fixed32_count = 5; alltypes.rep_fixed32[4] = 2008;
- alltypes.rep_sfixed32_count = 5; alltypes.rep_sfixed32[4] = 2009;
+ alltypes.rep_sfixed32_count = 5; alltypes.rep_sfixed32[4] = -2009;
alltypes.rep_float_count = 5; alltypes.rep_float[4] = 2010.0f;
alltypes.rep_fixed64_count = 5; alltypes.rep_fixed64[4] = 2011;
- alltypes.rep_sfixed64_count = 5; alltypes.rep_sfixed64[4] = 2012;
+ alltypes.rep_sfixed64_count = 5; alltypes.rep_sfixed64[4] = -2012;
alltypes.rep_double_count = 5; alltypes.rep_double[4] = 2013.0;
alltypes.rep_string_count = 5; strcpy(alltypes.rep_string[4], "2014");