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/acronym/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
30 changes: 15 additions & 15 deletions exercises/acronym/acronym_test.cpp
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
#include "acronym.h"
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
#define CATCH_CONFIG_MAIN
#include "test/catch.hpp"

using namespace std;

BOOST_AUTO_TEST_CASE(basic)
TEST_CASE("basic")
{
const string actual = acronym::acronym("Portable Network Graphics");

const string expected{"PNG"};

BOOST_TEST(expected == actual);
REQUIRE(expected == actual);
}

#if defined(EXERCISM_RUN_ALL_TESTS)
BOOST_AUTO_TEST_CASE(lowercase_words)
TEST_CASE("lowercase_words")
{
const string actual = acronym::acronym("Ruby on Rails");

const string expected{"ROR"};

BOOST_TEST(expected == actual);
REQUIRE(expected == actual);
}

BOOST_AUTO_TEST_CASE(punctuation)
TEST_CASE("punctuation")
{
const string actual = acronym::acronym("First In, First Out");

const string expected{"FIFO"};

BOOST_TEST(expected == actual);
REQUIRE(expected == actual);
}

BOOST_AUTO_TEST_CASE(all_caps_words)
TEST_CASE("all_caps_words")
{
const string actual = acronym::acronym("PHP: Hypertext Preprocessor");

const string expected{"PHP"};

BOOST_TEST(expected == actual);
REQUIRE(expected == actual);
}

BOOST_AUTO_TEST_CASE(non_acronym_all_caps_word)
TEST_CASE("non_acronym_all_caps_word")
{
const string actual = acronym::acronym("GNU Image Manipulation Program");

const string expected{"GIMP"};

BOOST_TEST(expected == actual);
REQUIRE(expected == actual);
}

BOOST_AUTO_TEST_CASE(hyphenated)
TEST_CASE("hyphenated")
{
const string actual = acronym::acronym("Complementary metal-oxide semiconductor");

const string expected{"CMOS"};

BOOST_TEST(expected == actual);
REQUIRE(expected == actual);
}

#endif
Loading