History

lib/tests: string_helpers: decouple unescape and escape cases

Patch series "lib/tests: string_helpers: Slight improvements". Two ad-hoc patches to improve the test module. It was induced by another patch that poorly tried to add (existing) test cases and make me revisit string_helpers_kunit.c. This patch (of 2): Currently the escape and unescape test cases go in one step. Decouple them for the better granularity and understanding test coverage in the results.

Andy Shevchenko committed 7 months ago

Commit f53718d1 parent 97bd80a1 file · +6 −0Browse files

Unified · Split

lib/tests/string_helpers_kunit.c+6−0
@@ -601,6 +601,11 @@ static void test_unescape(struct kunit *test) · 600 unmodified lines
601 test_string_unescape(test, "unescape", i, false);601 test_string_unescape(test, "unescape", i, false);
602 test_string_unescape(test, "unescape inplace",602 test_string_unescape(test, "unescape inplace",
603 get_random_u32_below(UNESCAPE_ALL_MASK + 1), true);603 get_random_u32_below(UNESCAPE_ALL_MASK + 1), true);
604}
605
606static void test_escape(struct kunit *test)
607{
608 unsigned int i;
604 609
605 /* Without dictionary */610 /* Without dictionary */
606 for (i = 0; i < ESCAPE_ALL_MASK + 1; i++)611 for (i = 0; i < ESCAPE_ALL_MASK + 1; i++)
@@ -615,6 +620,7 @@ static struct kunit_case string_helpers_test_cases[] = { · 8 unmodified lines
615 KUNIT_CASE(test_get_size),620 KUNIT_CASE(test_get_size),
616 KUNIT_CASE(test_upper_lower),621 KUNIT_CASE(test_upper_lower),
617 KUNIT_CASE(test_unescape),622 KUNIT_CASE(test_unescape),
623 KUNIT_CASE(test_escape),
618 {}624 {}
619};625};
620 626

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t