Skip to content

Commit

Permalink
fixup! add test-hexarray
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Sep 30, 2023
1 parent 53b3bec commit 045559b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions unit-tests/rsutils/string/test-hexarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]" );
Expand Down

0 comments on commit 045559b

Please sign in to comment.