From: Gerhard Sittig Date: Thu, 21 Dec 2023 20:22:43 +0000 (+0100) Subject: tests: adjust test coverage for power of two and input value 0 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;h=87e738be5134dbd48e724075fab88589f3bf7f71;hp=c3ada48afce7626a980c89e66d592a4242362c57;p=libsigrok.git tests: adjust test coverage for power of two and input value 0 An input value 0 for the sr_next_power_of_two() routine is not invalid any longer. Remove the test case that is expected to fail. Add a regular case to cover that code path instead. --- diff --git a/tests/strutil.c b/tests/strutil.c index 3cf132f0..3e43dbdc 100644 --- a/tests/strutil.c +++ b/tests/strutil.c @@ -578,6 +578,7 @@ static const struct power_case_t { size_t want_bits; size_t want_power; } power_cases[] = { + { 0, 1, 1, }, { 1, 1, 2, }, { 2, 2, 4, }, { 3, 2, 4, }, @@ -597,9 +598,6 @@ START_TEST(test_calc_power_of_two) const struct power_case_t *tcase; int ret; - ret = sr_next_power_of_two(0, NULL, NULL); - fail_unless(ret != SR_OK, "invalid value, did not fail"); - for (case_idx = 0; case_idx < ARRAY_SIZE(power_cases); case_idx++) { tcase = &power_cases[case_idx]; ret = sr_next_power_of_two(tcase->value, &bits, &power);