Skip to content

Commit

Permalink
Fix Sort People
Browse files Browse the repository at this point in the history
  • Loading branch information
hikjik committed Oct 17, 2023
1 parent e0e140d commit 75767fd
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions solutions/sort-the-people/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,25 @@

TEST_CASE("Simple") {
struct TestCase {
std::vector<std::string> names;std::vector<int> heights;std::vector<std::string> expected;
std::vector<std::string> names;
std::vector<int> heights;
std::vector<std::string> expected;
};

std::vector<TestCase> test_cases{
{.names{"Mary","John","Emma"},.heights{180,165,170},.expected{"Mary","Emma","John"},},{.names{"Alice","Bob","Bob"},.heights{155,185,150},.expected{"Bob","Alice","Bob"},},
{
.names{"Mary", "John", "Emma"},
.heights{180, 165, 170},
.expected{"Mary", "Emma", "John"},
},
{
.names{"Alice", "Bob", "Bob"},
.heights{155, 185, 150},
.expected{"Bob", "Alice", "Bob"},
},
};

for (const auto &[names,heights,expected] : test_cases) {
for (const auto &[names, heights, expected] : test_cases) {
const auto actual = Solution::sortPeople(names, heights);
REQUIRE(expected == actual);
}
Expand Down

0 comments on commit 75767fd

Please sign in to comment.