FAILED
Test 5
zero_is_an_error
TEST FAILURE
FAILED: REQUIRE_THROWS_AS( collatz_conjecture::steps(0), std::domain_error ) at /tmp/collatz-conjecture/collatz_conjecture_test.cpp:30
FAILED
Test 5
zero_is_an_error
FAILED: REQUIRE_THROWS_AS( collatz_conjecture::steps(0), std::domain_error ) at /tmp/collatz-conjecture/collatz_conjecture_test.cpp:30
Hi @ArtyomCoder, welcome to the Exercism Forum and thank you for posting! My name is Jonathan and Iām the Community Manager - great to have you here.
If you could help us out by fleshing out the issue you are having with more detail that would be great. For example, is there a screenshot of your code? What was the issue specifically? What were you trying to do etc?
Currently it is a little tricky to understand what you need help with
Thanks!
Look at the last two tests:
TEST_CASE("zero_is_an_error")
{
REQUIRE_THROWS_AS(collatz_conjecture::steps(0), std::domain_error);
}
TEST_CASE("negative_value_is_an_error")
{
REQUIRE_THROWS_AS(collatz_conjecture::steps(-15), std::domain_error);
}
They expect the function to throw
an exception (specifically std::domain_error
) if the parameter is non-positive.
For more about exceptions you might want to read Chapter 20: Exceptions at LearnCpp.com.