Skip to content

Outline tests execute the first test twice and skip the final test #2298

@shariarriday

Description

@shariarriday

The following test is not executed correctly in the current testing framework.

const auto expected = std::vector<int>{3, 6, 13};

OUTLINE("comparing numbers") {
  GIVEN("the numbers <x> and <y>") {
    auto [x, y] = block_parameters<double, double>();
    WHEN("adding both numbers") {
      auto result = x + y;
      THEN("the sum: <sum> should be in expected") {
        const auto index = block_parameters_index();
        auto sum = block_parameters<double>();
        check_eq(result, caf::test::approx{sum});
        check_eq(result, expected[index]);
      }
    }
  }
  EXAMPLES = R"(
    |   x |   y | sum |
    |   1 |   2 |   3 |
    | 2.5 | 3.5 |   6 |
    | 9.5 | 3.5 |  13 |
  )";
}

The expectation is that the test will pass after executing each line in the example once. But, the first line is executed twice and the last line is not executed at all. Which fails all of the test except the first one.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions