1
exercism fetch cpp nth-prime

nth_prime_test.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "nth_prime.h"
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <stdexcept>

BOOST_AUTO_TEST_CASE(first)
{
    BOOST_REQUIRE_EQUAL(2, prime::nth(1));
}

#if defined(EXERCISM_RUN_ALL_TESTS)
BOOST_AUTO_TEST_CASE(second)
{
    BOOST_REQUIRE_EQUAL(3, prime::nth(2));
}

BOOST_AUTO_TEST_CASE(sixth)
{
    BOOST_REQUIRE_EQUAL(13, prime::nth(6));
}

BOOST_AUTO_TEST_CASE(big_prime)
{
    BOOST_REQUIRE_EQUAL(104743, prime::nth(10001));
}

BOOST_AUTO_TEST_CASE(weird_case)
{
    BOOST_REQUIRE_THROW(prime::nth(0), std::domain_error);
}
#endif