t: Add coverage

Remove a redundant test and add two large number test cases.
This commit is contained in:
Ilya Lipnitskiy 2015-12-12 19:38:12 -08:00
parent 6fc4e97bf0
commit a8d746a27c
3 changed files with 7 additions and 15 deletions

View File

@ -4,7 +4,7 @@
#define THOUSAND 1000
#define MILLION 1000000
#define BILLION 1000000000
#define BILLION 1000000000LL
#define TRILLION 1000000000000LL
#define QUADRILLION 1000000000000000LL
#define QUINTILLION 1000000000000000000LL

View File

@ -228,8 +228,12 @@ static void dump_test_required_uint64 (void)
dump_message_bytes (&mess, "test_required_uint64_mill");
mess.set_test (BILLION);
dump_message_bytes (&mess, "test_required_uint64_bill");
mess.set_test (BILLION*20);
dump_message_bytes (&mess, "test_required_uint64_20_bill");
mess.set_test (TRILLION);
dump_message_bytes (&mess, "test_required_uint64_tril");
mess.set_test (TRILLION*20);
dump_message_bytes (&mess, "test_required_uint64_20_tril");
mess.set_test (QUADRILLION);
dump_message_bytes (&mess, "test_required_uint64_quad");
mess.set_test (QUINTILLION);

View File

@ -313,7 +313,9 @@ static void test_required_uint64 (void)
DO_TEST(THOUSAND, test_required_uint64_thou);
DO_TEST(MILLION, test_required_uint64_mill);
DO_TEST(BILLION, test_required_uint64_bill);
DO_TEST(BILLION*20, test_required_uint64_20_bill);
DO_TEST(TRILLION, test_required_uint64_tril);
DO_TEST(TRILLION*20, test_required_uint64_20_tril);
DO_TEST(QUADRILLION, test_required_uint64_quad);
DO_TEST(QUINTILLION, test_required_uint64_quint);
DO_TEST(UINT64_MAX, test_required_uint64_max);
@ -2149,18 +2151,6 @@ test_message_check(void)
assert(1 == protobuf_c_message_check(&m.base));
}
static void
test_large_int_packed_size(void)
{
Foo__TestMessRequiredSInt64 m = FOO__TEST_MESS_REQUIRED_SINT64__INIT;
m.test = 200;
assert(3 == foo__test_mess_required_sint64__get_packed_size(&m));
m.test = 32000;
assert(4 == foo__test_mess_required_sint64__get_packed_size(&m));
}
/* === simple testing framework === */
typedef void (*TestFunc) (void);
@ -2296,8 +2286,6 @@ static Test tests[] =
{ "test field flags", test_field_flags },
{ "test message_check()", test_message_check },
{ "test large int packed size", test_large_int_packed_size },
};
#define n_tests (sizeof(tests)/sizeof(Test))