From 045559bca19d0997613dfd0d0ff5564eae5bdd41 Mon Sep 17 00:00:00 2001 From: Eran Date: Sat, 30 Sep 2023 09:07:51 +0300 Subject: [PATCH] fixup! add test-hexarray --- unit-tests/rsutils/string/test-hexarray.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/unit-tests/rsutils/string/test-hexarray.cpp b/unit-tests/rsutils/string/test-hexarray.cpp index 7dcf0b3b38d..df38f1ab24a 100644 --- a/unit-tests/rsutils/string/test-hexarray.cpp +++ b/unit-tests/rsutils/string/test-hexarray.cpp @@ -208,6 +208,15 @@ TEST_CASE( "hexdump format {repeat:}", "[hexarray]" ) { CHECK( to_string( hexdump( ba.data(), ba.size() ).format( "[{2}{repeat:} {2}{:}]" ) ) == "[0001 0203 0405 0607 0809]" ); } + SECTION( "without {:}, doesn't repeat" ) + { + CHECK( to_string( hexdump( ba.data(), ba.size() ).format( "[{2}{repeat:} {2}]" ) ) == "[0001 0203]" ); + } + SECTION( "nothing inside repeat will repeat forever unless we add a skip or limit reps" ) + { + CHECK( to_string( hexdump( ba.data(), ba.size() ).format( "[{2}{repeat:}{+2}{:}]" ) ) == "[0001]" ); + CHECK( to_string( hexdump( ba.data(), ba.size() ).format( "[{2}{repeat:2}{:}]" ) ) == "[0001]" ); + } SECTION( "only twice, no ..." ) { CHECK( to_string( hexdump( ba.data(), ba.size() ).format( "[{2}{repeat:2} {2}{:}]" ) ) == "[0001 0203 0405]" );