From 38a6087bef6339a466f76759cc03992d3f29f065 Mon Sep 17 00:00:00 2001 From: Patrick Jackson Date: Sat, 14 Oct 2017 17:16:29 -0700 Subject: [PATCH 1/3] Improve robot-name test. --- exercises/robot-name/robot_name_test.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/exercises/robot-name/robot_name_test.cpp b/exercises/robot-name/robot_name_test.cpp index 3e617f3d..4600e1b4 100644 --- a/exercises/robot-name/robot_name_test.cpp +++ b/exercises/robot-name/robot_name_test.cpp @@ -1,20 +1,22 @@ #include "robot_name.h" #define BOOST_TEST_MAIN #include -#include +#include +#include +#include using namespace std; namespace { -const boost::regex name_pattern{R"name(^[[:upper:]]{2}\d{3}$)name"}; +const regex name_pattern("[A-Z]{2}[0-9]{3}"); } BOOST_AUTO_TEST_CASE(has_a_name) { const robot_name::robot robot; - BOOST_REQUIRE(boost::regex_match(robot.name(), name_pattern)); + BOOST_REQUIRE(regex_match(robot.name(), name_pattern)); } #if defined(EXERCISM_RUN_ALL_TESTS) @@ -46,12 +48,14 @@ BOOST_AUTO_TEST_CASE(is_able_to_reset_name) BOOST_AUTO_TEST_CASE(exhausting_digits_yields_different_names) { robot_name::robot robot; - auto last_name = robot.name(); + unordered_set names; + names.insert(robot.name()); for (int i = 0; i < 1000; ++i) { robot.reset(); - BOOST_REQUIRE_NE(last_name, robot.name()); - BOOST_REQUIRE(boost::regex_match(robot.name(), name_pattern)); + BOOST_REQUIRE_EQUAL(names.count(robot.name()), 0); + BOOST_REQUIRE(regex_match(robot.name(), name_pattern)); + names.insert(robot.name()); } } #endif From 0c0167ac723d92a96984369d44a10dd617854b8f Mon Sep 17 00:00:00 2001 From: Patrick Jackson Date: Sat, 14 Oct 2017 17:26:59 -0700 Subject: [PATCH 2/3] Remove Boost.Regex from CMake, Travis, and Docs. --- .travis.yml | 2 +- docs/INSTALLATION.md | 5 ++--- exercises/allergies/CMakeLists.txt | 4 ++-- exercises/anagram/CMakeLists.txt | 4 ++-- exercises/atbash-cipher/CMakeLists.txt | 4 ++-- exercises/beer-song/CMakeLists.txt | 4 ++-- exercises/binary/CMakeLists.txt | 4 ++-- exercises/bob/CMakeLists.txt | 4 ++-- exercises/bracket-push/CMakeLists.txt | 4 ++-- exercises/clock/CMakeLists.txt | 4 ++-- exercises/crypto-square/CMakeLists.txt | 4 ++-- exercises/difference-of-squares/CMakeLists.txt | 4 ++-- exercises/etl/CMakeLists.txt | 4 ++-- exercises/food-chain/CMakeLists.txt | 4 ++-- exercises/gigasecond/CMakeLists.txt | 4 ++-- exercises/grade-school/CMakeLists.txt | 4 ++-- exercises/grains/CMakeLists.txt | 4 ++-- exercises/hamming/CMakeLists.txt | 4 ++-- exercises/hello-world/CMakeLists.txt | 4 ++-- exercises/hexadecimal/CMakeLists.txt | 4 ++-- exercises/leap/CMakeLists.txt | 4 ++-- exercises/meetup/CMakeLists.txt | 4 ++-- exercises/nth-prime/CMakeLists.txt | 4 ++-- exercises/nucleotide-count/CMakeLists.txt | 4 ++-- exercises/pangram/CMakeLists.txt | 4 ++-- exercises/phone-number/CMakeLists.txt | 4 ++-- exercises/prime-factors/CMakeLists.txt | 4 ++-- exercises/queen-attack/CMakeLists.txt | 4 ++-- exercises/raindrops/CMakeLists.txt | 4 ++-- exercises/rna-transcription/CMakeLists.txt | 4 ++-- exercises/robot-name/CMakeLists.txt | 4 ++-- exercises/roman-numerals/CMakeLists.txt | 4 ++-- exercises/say/CMakeLists.txt | 4 ++-- exercises/scrabble-score/CMakeLists.txt | 4 ++-- exercises/series/CMakeLists.txt | 4 ++-- exercises/sieve/CMakeLists.txt | 4 ++-- exercises/space-age/CMakeLists.txt | 4 ++-- exercises/sum-of-multiples/CMakeLists.txt | 4 ++-- exercises/triangle/CMakeLists.txt | 4 ++-- exercises/trinary/CMakeLists.txt | 4 ++-- exercises/word-count/CMakeLists.txt | 4 ++-- 41 files changed, 81 insertions(+), 82 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f4f6db1..651be2a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ before_install: - sudo apt-get -y -d update - eval "${MATRIX_EVAL}" install: - - sudo apt-get -y install libboost-regex1.60-dev libboost-test1.60-dev libboost-date-time1.60-dev + - sudo apt-get -y install libboost-test1.60-dev libboost-date-time1.60-dev script: - bin/fetch-configlet - bin/configlet lint . diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index d4c9578b..215e8325 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -81,8 +81,8 @@ The unit tests use Boost.Test, the unit testing framework included with in Boost useful to you as you work through the exercises. You will need to download and install Boost. As of this writing Boost 1.59+ is the required version. You will need a compiled version of the -boost libraries Boost.Test, Boost.DateTime and Boost.Regex, or you will -need to download from source and build the library yourself. +boost libraries Boost.Test and Boost.DateTime or you will need to +download from source and build the library yourself. If you are having difficulties installing Boost for use with exercism, [ask for help](https://github.com/exercism/cpp/issues). @@ -143,7 +143,6 @@ CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoos boost_unit_test_framework boost_date_time - boost_regex No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of diff --git a/exercises/allergies/CMakeLists.txt b/exercises/allergies/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/allergies/CMakeLists.txt +++ b/exercises/allergies/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/anagram/CMakeLists.txt b/exercises/anagram/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/anagram/CMakeLists.txt +++ b/exercises/anagram/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/atbash-cipher/CMakeLists.txt b/exercises/atbash-cipher/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/atbash-cipher/CMakeLists.txt +++ b/exercises/atbash-cipher/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/beer-song/CMakeLists.txt b/exercises/beer-song/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/beer-song/CMakeLists.txt +++ b/exercises/beer-song/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/binary/CMakeLists.txt b/exercises/binary/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/binary/CMakeLists.txt +++ b/exercises/binary/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/bob/CMakeLists.txt b/exercises/bob/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/bob/CMakeLists.txt +++ b/exercises/bob/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/bracket-push/CMakeLists.txt b/exercises/bracket-push/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/bracket-push/CMakeLists.txt +++ b/exercises/bracket-push/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/clock/CMakeLists.txt b/exercises/clock/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/clock/CMakeLists.txt +++ b/exercises/clock/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/crypto-square/CMakeLists.txt b/exercises/crypto-square/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/crypto-square/CMakeLists.txt +++ b/exercises/crypto-square/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/difference-of-squares/CMakeLists.txt b/exercises/difference-of-squares/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/difference-of-squares/CMakeLists.txt +++ b/exercises/difference-of-squares/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/etl/CMakeLists.txt b/exercises/etl/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/etl/CMakeLists.txt +++ b/exercises/etl/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/food-chain/CMakeLists.txt b/exercises/food-chain/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/food-chain/CMakeLists.txt +++ b/exercises/food-chain/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/gigasecond/CMakeLists.txt b/exercises/gigasecond/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/gigasecond/CMakeLists.txt +++ b/exercises/gigasecond/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/grade-school/CMakeLists.txt b/exercises/grade-school/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/grade-school/CMakeLists.txt +++ b/exercises/grade-school/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/grains/CMakeLists.txt b/exercises/grains/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/grains/CMakeLists.txt +++ b/exercises/grains/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/hamming/CMakeLists.txt b/exercises/hamming/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/hamming/CMakeLists.txt +++ b/exercises/hamming/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/hello-world/CMakeLists.txt b/exercises/hello-world/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/hello-world/CMakeLists.txt +++ b/exercises/hello-world/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/hexadecimal/CMakeLists.txt b/exercises/hexadecimal/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/hexadecimal/CMakeLists.txt +++ b/exercises/hexadecimal/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/leap/CMakeLists.txt b/exercises/leap/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/leap/CMakeLists.txt +++ b/exercises/leap/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/meetup/CMakeLists.txt b/exercises/meetup/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/meetup/CMakeLists.txt +++ b/exercises/meetup/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/nth-prime/CMakeLists.txt b/exercises/nth-prime/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/nth-prime/CMakeLists.txt +++ b/exercises/nth-prime/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/nucleotide-count/CMakeLists.txt b/exercises/nucleotide-count/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/nucleotide-count/CMakeLists.txt +++ b/exercises/nucleotide-count/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/pangram/CMakeLists.txt b/exercises/pangram/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/pangram/CMakeLists.txt +++ b/exercises/pangram/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/phone-number/CMakeLists.txt b/exercises/phone-number/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/phone-number/CMakeLists.txt +++ b/exercises/phone-number/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/prime-factors/CMakeLists.txt b/exercises/prime-factors/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/prime-factors/CMakeLists.txt +++ b/exercises/prime-factors/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/queen-attack/CMakeLists.txt b/exercises/queen-attack/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/queen-attack/CMakeLists.txt +++ b/exercises/queen-attack/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/raindrops/CMakeLists.txt b/exercises/raindrops/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/raindrops/CMakeLists.txt +++ b/exercises/raindrops/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/rna-transcription/CMakeLists.txt b/exercises/rna-transcription/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/rna-transcription/CMakeLists.txt +++ b/exercises/rna-transcription/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/robot-name/CMakeLists.txt b/exercises/robot-name/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/robot-name/CMakeLists.txt +++ b/exercises/robot-name/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/roman-numerals/CMakeLists.txt b/exercises/roman-numerals/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/roman-numerals/CMakeLists.txt +++ b/exercises/roman-numerals/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/say/CMakeLists.txt b/exercises/say/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/say/CMakeLists.txt +++ b/exercises/say/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/scrabble-score/CMakeLists.txt b/exercises/scrabble-score/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/scrabble-score/CMakeLists.txt +++ b/exercises/scrabble-score/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/series/CMakeLists.txt b/exercises/series/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/series/CMakeLists.txt +++ b/exercises/series/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/sieve/CMakeLists.txt b/exercises/sieve/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/sieve/CMakeLists.txt +++ b/exercises/sieve/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/space-age/CMakeLists.txt b/exercises/space-age/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/space-age/CMakeLists.txt +++ b/exercises/space-age/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/sum-of-multiples/CMakeLists.txt b/exercises/sum-of-multiples/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/sum-of-multiples/CMakeLists.txt +++ b/exercises/sum-of-multiples/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/triangle/CMakeLists.txt b/exercises/triangle/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/triangle/CMakeLists.txt +++ b/exercises/triangle/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/trinary/CMakeLists.txt b/exercises/trinary/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/trinary/CMakeLists.txt +++ b/exercises/trinary/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") diff --git a/exercises/word-count/CMakeLists.txt b/exercises/word-count/CMakeLists.txt index 97b347ff..534c450b 100644 --- a/exercises/word-count/CMakeLists.txt +++ b/exercises/word-count/CMakeLists.txt @@ -7,11 +7,11 @@ cmake_minimum_required(VERSION 2.8.11) # Name the project after the exercise project(${exercise} CXX) -# Locate Boost libraries: unit_test_framework, date_time and regex +# 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 regex) +find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time) # Enable C++11 features on gcc/clang if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)") From 9ea7a5bdb4796dce4c8fc69639dc8496967c2c90 Mon Sep 17 00:00:00 2001 From: Patrick Jackson Date: Sun, 15 Oct 2017 12:28:16 -0700 Subject: [PATCH 3/3] Removing use of regex entirely due to compiler implementation differences. --- exercises/robot-name/robot_name_test.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/exercises/robot-name/robot_name_test.cpp b/exercises/robot-name/robot_name_test.cpp index 4600e1b4..af0cd993 100644 --- a/exercises/robot-name/robot_name_test.cpp +++ b/exercises/robot-name/robot_name_test.cpp @@ -1,22 +1,25 @@ #include "robot_name.h" #define BOOST_TEST_MAIN #include -#include +#include #include #include using namespace std; -namespace +static bool validate_name(string name) { -const regex name_pattern("[A-Z]{2}[0-9]{3}"); + if (name.length() != 5) + return false; + return isupper(name[0]) && isupper(name[1]) && isdigit(name[2]) + && isdigit(name[3]) && isdigit(name[4]); } BOOST_AUTO_TEST_CASE(has_a_name) { const robot_name::robot robot; - BOOST_REQUIRE(regex_match(robot.name(), name_pattern)); + BOOST_REQUIRE(validate_name(robot.name())); } #if defined(EXERCISM_RUN_ALL_TESTS) @@ -54,7 +57,7 @@ BOOST_AUTO_TEST_CASE(exhausting_digits_yields_different_names) for (int i = 0; i < 1000; ++i) { robot.reset(); BOOST_REQUIRE_EQUAL(names.count(robot.name()), 0); - BOOST_REQUIRE(regex_match(robot.name(), name_pattern)); + BOOST_REQUIRE(validate_name(robot.name())); names.insert(robot.name()); } }