Added test for padding with custom base

This commit is contained in:
Leonetienne 2022-02-27 19:37:39 +01:00
parent efec74dfbb
commit 51503ba0a8

View File

@ -241,3 +241,19 @@ TEST_CASE(__FILE__"/Base1_fruits_to_10", "[BaseX_2_Y]")
// Verify
REQUIRE(out == expected_out);
}
// Tests that padding with custom digit types works
TEST_CASE(__FILE__"/TestPadding_CustomDigitTypes", "[BaseX_2_Y]")
{
// Setup
const std::string set_in = "0123456789";
const std::vector<std::string> set_out = { "apple", "banana", "tomato" };
const std::string in = "50";
const std::vector<std::string> expected_out = { "apple", "apple", "apple", "apple", "banana", "tomato", "banana", "tomato" };
// Exercise
const std::vector<std::string> out = GeneralUtility::BaseX_2_Y(in, set_in, set_out, 8);
// Verify
REQUIRE(out == expected_out);
}