Skip to content

Commit 432907e

Browse files
committed
removed division by 0
1 parent 535c8b3 commit 432907e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

gtest/test_results.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ class test_results_1 : public ::testing::Test
1414
cuke::registry().clear();
1515
cuke::registry().push_step(cuke::internal::step(
1616
[](const cuke::value_array&, const auto&, const auto&, const auto&) {},
17-
"a step" //,
18-
// cuke::internal::step::type::step, "some func name","this file", 99
19-
));
17+
"a step", cuke::internal::step::type::step, "some func name",
18+
"this file", 99));
2019
cuke::registry().push_step(cuke::internal::step(
2120
[](const cuke::value_array&, const auto&, const auto&, const auto&)
2221
{ cuke::is_true(false); },
@@ -62,7 +61,7 @@ TEST_F(test_results_1, scenario_passed)
6261
EXPECT_EQ(step.status, cuke::results::test_status::passed);
6362
// NOTE: source location is set in step constructor in SetUp() function of
6463
// this suite
65-
// EXPECT_EQ(step.source_location, std::format("this file:{}", 99));
64+
EXPECT_EQ(step.source_location, std::format("this file:{}", 99));
6665
EXPECT_EQ(step.keyword, std::string("Given"));
6766
EXPECT_EQ(step.name, std::string("a step"));
6867
EXPECT_EQ(step.id, std::string("A Feature;First Scenario;a step"));

src/table.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ bool table::append_row(value_array&& row)
4141
}
4242
std::size_t table::row_count() const noexcept
4343
{
44+
if (m_data.size() == 0 || m_col_count == 0)
45+
{
46+
return 0;
47+
}
4448
return m_data.size() / m_col_count;
4549
}
4650
std::size_t table::col_count() const noexcept { return m_col_count; }

0 commit comments

Comments
 (0)