From 51503ba0a84e1356f3795a19d5c6b5af032ca7b5 Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Sun, 27 Feb 2022 19:37:39 +0100 Subject: [PATCH] Added test for padding with custom base --- Test/BaseX_2_Y.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Test/BaseX_2_Y.cpp b/Test/BaseX_2_Y.cpp index de5e61e..981aa35 100644 --- a/Test/BaseX_2_Y.cpp +++ b/Test/BaseX_2_Y.cpp @@ -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 set_out = { "apple", "banana", "tomato" }; + const std::string in = "50"; + const std::vector expected_out = { "apple", "apple", "apple", "apple", "banana", "tomato", "banana", "tomato" }; + + // Exercise + const std::vector out = GeneralUtility::BaseX_2_Y(in, set_in, set_out, 8); + + // Verify + REQUIRE(out == expected_out); +}