Skip to content

Commit

Permalink
More 0-value checks for the "width 20" testcase.
Browse files Browse the repository at this point in the history
  • Loading branch information
eyalroz committed Aug 3, 2021
1 parent 0c59552 commit b5d9f90
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion test/test_suite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ TEST_CASE("# flag", "[]" ) {
test::sprintf_(buffer, "%#.4o", 1);
CHECK(!strcmp(buffer, "0001"));

test::sprintf(buffer, "%#04x", 0x1001);
test::sprintf_(buffer, "%#04x", 0x1001);
CHECK(!strcmp(buffer, "0x1001"));
test::sprintf_(buffer, "%#04o", 01001);
CHECK(!strcmp(buffer, "01001"));
Expand Down Expand Up @@ -652,6 +652,9 @@ TEST_CASE("width 20", "[]" ) {
test::sprintf_(buffer, "%20i", -1024);
CHECK(!strcmp(buffer, " -1024"));

test::sprintf(buffer, "%20i", 0);
CHECK(!strcmp(buffer, " 0"));

test::sprintf_(buffer, "%20u", 1024);
CHECK(!strcmp(buffer, " 1024"));

Expand All @@ -676,6 +679,15 @@ TEST_CASE("width 20", "[]" ) {
test::sprintf_(buffer, "%20X", 3989525555U);
CHECK(!strcmp(buffer, " EDCB5433"));

test::sprintf_(buffer, "%20X", 0);
CHECK(!strcmp(buffer, " 0"));

test::sprintf_(buffer, "%20X", 0U);
CHECK(!strcmp(buffer, " 0"));

test::sprintf_(buffer, "%20llX", 0U);
CHECK(!strcmp(buffer, " 0"));

test::sprintf_(buffer, "%20c", 'x');
CHECK(!strcmp(buffer, " x"));
}
Expand Down

0 comments on commit b5d9f90

Please sign in to comment.