Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions exercises/grains/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ cmake_minimum_required(VERSION 3.1.3)
# Name the project after the exercise
project(${exercise} CXX)

# Locate Boost libraries: unit_test_framework and date_time
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time)

# Get a source filename from the exercise name by replacing -'s with _'s
string(REPLACE "-" "_" file ${exercise})

Expand All @@ -38,13 +32,6 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
)
endif()

# We need boost libraries
target_link_libraries(${exercise}
PRIVATE
Boost::unit_test_framework
Boost::date_time
)

# Configure to run all the tests?
if(${EXERCISM_RUN_ALL_TESTS})
target_compile_definitions(${exercise} PRIVATE EXERCISM_RUN_ALL_TESTS)
Expand Down
36 changes: 18 additions & 18 deletions exercises/grains/grains_test.cpp
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
#include "grains.h"
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#define CATCH_CONFIG_MAIN
#include "test/catch.hpp"

BOOST_AUTO_TEST_CASE(square_1)
TEST_CASE("square_1")
{
BOOST_REQUIRE_EQUAL(1ULL, grains::square(1));
REQUIRE(1ULL == grains::square(1));
}

#if defined(EXERCISM_RUN_ALL_TESTS)
BOOST_AUTO_TEST_CASE(square_2)
TEST_CASE("square_2")
{
BOOST_REQUIRE_EQUAL(2ULL, grains::square(2));
REQUIRE(2ULL == grains::square(2));
}

BOOST_AUTO_TEST_CASE(square_3)
TEST_CASE("square_3")
{
BOOST_REQUIRE_EQUAL(4ULL, grains::square(3));
REQUIRE(4ULL == grains::square(3));
}

BOOST_AUTO_TEST_CASE(square_4)
TEST_CASE("square_4")
{
BOOST_REQUIRE_EQUAL(8ULL, grains::square(4));
REQUIRE(8ULL == grains::square(4));
}

BOOST_AUTO_TEST_CASE(square_16)
TEST_CASE("square_16")
{
BOOST_REQUIRE_EQUAL(32768ULL, grains::square(16));
REQUIRE(32768ULL == grains::square(16));
}

BOOST_AUTO_TEST_CASE(square_32)
TEST_CASE("square_32")
{
BOOST_REQUIRE_EQUAL(2147483648ULL, grains::square(32));
REQUIRE(2147483648ULL == grains::square(32));
}

BOOST_AUTO_TEST_CASE(square_64)
TEST_CASE("square_64")
{
BOOST_REQUIRE_EQUAL(9223372036854775808ULL, grains::square(64));
REQUIRE(9223372036854775808ULL == grains::square(64));
}

BOOST_AUTO_TEST_CASE(total)
TEST_CASE("total")
{
BOOST_REQUIRE_EQUAL(18446744073709551615ULL, grains::total());
REQUIRE(18446744073709551615ULL == grains::total());
}
#endif
Loading