123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include <catch2/catch.hpp>
- #include <string>
- struct TestSubject {
-
-
- size_t GetLength( const std::string& input ) const { return input.size(); }
- };
- TEST_CASE("Table allows pre-computed test inputs and outputs", "[example][generator]") {
- using std::make_tuple;
-
- TestSubject subj;
- SECTION("This section is run for each row in the table") {
- std::string test_input;
- size_t expected_output;
- std::tie( test_input, expected_output ) =
- GENERATE( table<std::string, size_t>(
- {
- make_tuple( "one", 3 ),
- make_tuple( "two", 3 ),
- make_tuple( "three", 5 ),
- make_tuple( "four", 4 ) } ) );
-
- auto result = subj.GetLength(test_input);
-
- CAPTURE(test_input);
-
- REQUIRE(result == expected_output);
- }
- }
|