trackler 2.1.0.0 → 2.1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/exercises/connect/description.md +2 -1
- data/common/exercises/crypto-square/canonical-data.json +2 -2
- data/common/exercises/two-bucket/canonical-data.json +27 -1
- data/lib/trackler/version.rb +1 -1
- data/tracks/c/exercises/perfect-numbers/src/example.c +8 -4
- data/tracks/clojure/config.json +5 -0
- data/tracks/clojure/exercises/secret-handshake/project.clj +4 -0
- data/tracks/clojure/exercises/secret-handshake/src/example.clj +19 -0
- data/tracks/clojure/exercises/secret-handshake/test/secret_handshake_test.clj +55 -0
- data/tracks/cpp/.travis.yml +4 -3
- data/tracks/cpp/README.md +1 -1
- data/tracks/cpp/config.json +171 -67
- data/tracks/cpp/docs/ABOUT.md +2 -2
- data/tracks/cpp/docs/INSTALLATION.md +22 -28
- data/tracks/cpp/docs/TESTS.md +1 -1
- data/tracks/cpp/exercises/anagram/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/beer-song/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/binary/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/bob/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/clock/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/clock/clock_test.cpp +188 -64
- data/tracks/cpp/exercises/clock/example.cpp +17 -12
- data/tracks/cpp/exercises/clock/example.h +1 -0
- data/tracks/cpp/exercises/crypto-square/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/difference-of-squares/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/etl/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/etl/etl_test.cpp +5 -5
- data/tracks/cpp/exercises/food-chain/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/gigasecond/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/gigasecond/example.cpp +2 -6
- data/tracks/cpp/exercises/gigasecond/example.h +2 -2
- data/tracks/cpp/exercises/gigasecond/gigasecond_test.cpp +26 -8
- data/tracks/cpp/exercises/grade-school/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/grade-school/grade_school_test.cpp +5 -6
- data/tracks/cpp/exercises/grains/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/hamming/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/hello-world/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/hexadecimal/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/leap/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/meetup/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/meetup/meetup_test.cpp +1 -1
- data/tracks/cpp/exercises/nth-prime/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/nucleotide-count/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/nucleotide-count/nucleotide_count_test.cpp +3 -4
- data/tracks/cpp/exercises/phone-number/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/prime-factors/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/queen-attack/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/raindrops/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/rna-transcription/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/robot-name/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/roman-numerals/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/say/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/scrabble-score/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/series/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/series/series_test.cpp +11 -11
- data/tracks/cpp/exercises/sieve/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/space-age/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/sum-of-multiples/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/triangle/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/trinary/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/word-count/CMakeLists.txt +2 -9
- data/tracks/cpp/exercises/word-count/word_count_test.cpp +14 -15
- data/tracks/go/README.md +27 -13
- data/tracks/go/config.json +1 -0
- data/tracks/go/exercises/connect/.meta/gen.go +1 -3
- data/tracks/go/exercises/connect/cases_test.go +2 -1
- data/tracks/go/exercises/custom-set/.meta/gen.go +122 -101
- data/tracks/go/exercises/custom-set/cases_test.go +13 -4
- data/tracks/go/exercises/custom-set/custom_set_test.go +2 -2
- data/tracks/go/exercises/hamming/.meta/gen.go +1 -3
- data/tracks/go/exercises/hamming/cases_test.go +7 -1
- data/tracks/go/exercises/hamming/example.go +1 -1
- data/tracks/go/exercises/hamming/hamming_test.go +1 -1
- data/tracks/go/exercises/hello-world/{hello_example_test.go → example_helloworld_test.go} +0 -0
- data/tracks/go/exercises/house/house_test.go +8 -8
- data/tracks/go/exercises/meetup/.meta/gen.go +1 -3
- data/tracks/go/exercises/meetup/cases_test.go +2 -1
- data/tracks/go/exercises/palindrome-products/example.go +1 -1
- data/tracks/go/exercises/palindrome-products/palindrome_products_test.go +1 -1
- data/tracks/go/exercises/pascals-triangle/pascals_triangle_test.go +24 -4
- data/tracks/go/exercises/rna-transcription/.meta/gen.go +1 -3
- data/tracks/go/exercises/rna-transcription/cases_test.go +2 -1
- data/tracks/go/exercises/roman-numerals/.meta/gen.go +1 -3
- data/tracks/go/exercises/roman-numerals/cases_test.go +2 -1
- data/tracks/go/exercises/roman-numerals/example.go +1 -1
- data/tracks/go/exercises/transpose/.meta/gen.go +1 -3
- data/tracks/go/exercises/transpose/cases_test.go +2 -1
- data/tracks/go/exercises/transpose/transpose_test.go +5 -0
- data/tracks/go/exercises/word-count/.meta/gen.go +1 -3
- data/tracks/go/exercises/word-count/cases_test.go +2 -1
- data/tracks/go/gen/gen.go +3 -2
- data/tracks/java/config.json +5 -0
- data/tracks/java/exercises/saddle-points/build.gradle +17 -0
- data/tracks/java/exercises/saddle-points/src/example/java/Matrix.java +44 -0
- data/tracks/java/exercises/saddle-points/src/example/java/MatrixCoordinate.java +31 -0
- data/tracks/java/exercises/saddle-points/src/main/java/Matrix.java +5 -0
- data/tracks/java/exercises/saddle-points/src/main/java/MatrixCoordinate.java +31 -0
- data/tracks/java/exercises/saddle-points/src/test/java/MatrixTest.java +82 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/javascript/.travis.yml +3 -1
- data/tracks/javascript/Makefile +2 -8
- data/tracks/javascript/SETUP.md +1 -2
- data/tracks/javascript/docs/INSTALLATION.md +3 -4
- data/tracks/javascript/docs/TESTS.md +14 -26
- data/tracks/javascript/exercises/hamming/example.js +7 -11
- data/tracks/javascript/exercises/hello-world/HINTS.md +3 -3
- data/tracks/javascript/exercises/robot-simulator/example.js +72 -73
- data/tracks/perl6/config.json +5 -0
- data/tracks/perl6/exercises/clock/Clock.pm6 +4 -0
- data/tracks/perl6/exercises/clock/Example.pm6 +12 -0
- data/tracks/perl6/exercises/clock/clock.t +534 -0
- data/tracks/perl6/exercises/clock/example.yaml +16 -0
- data/tracks/perl6/exercises/robot-name/Example.pm +11 -4
- data/tracks/php/exercises/hello-world/hello-world.php +1 -1
- data/tracks/php/exercises/hello-world/hello-world_test.php +1 -11
- data/tracks/php/exercises/robot-name/robot-name_test.php +1 -0
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/largest-series-product/bower.json +16 -0
- data/tracks/purescript/exercises/largest-series-product/examples/src/LargestSeriesProduct.purs +31 -0
- data/tracks/purescript/exercises/largest-series-product/src/LargestSeriesProduct.purs +3 -0
- data/tracks/purescript/exercises/largest-series-product/test/Main.purs +73 -0
- data/tracks/python/exercises/sublist/sublist_test.py +94 -55
- data/tracks/ruby/README.md +38 -25
- data/tracks/ruby/exercises/hamming/example.tt +6 -4
- data/tracks/ruby/exercises/hamming/hamming_test.rb +4 -5
- data/tracks/ruby/exercises/linked-list/linked_list_test.rb +16 -0
- data/tracks/ruby/exercises/luhn/luhn_test.rb +5 -5
- data/tracks/ruby/exercises/ocr-numbers/.meta/.version +1 -0
- data/tracks/ruby/exercises/ocr-numbers/example.rb +42 -61
- data/tracks/ruby/exercises/ocr-numbers/example.tt +21 -0
- data/tracks/ruby/exercises/ocr-numbers/ocr_numbers_test.rb +63 -138
- data/tracks/ruby/lib/generator/exercise_cases.rb +43 -0
- data/tracks/ruby/lib/generator/underscore.rb +9 -0
- data/tracks/ruby/lib/hamming_cases.rb +9 -14
- data/tracks/ruby/lib/luhn_cases.rb +2 -18
- data/tracks/ruby/lib/ocr_numbers_cases.rb +20 -0
- data/tracks/ruby/lib/pig_latin_cases.rb +2 -12
- data/tracks/ruby/test/generator/underscore_test.rb +23 -0
- data/tracks/scala/config.json +316 -316
- metadata +26 -10
- data/tracks/cpp/exercises/etl/require_equal_containers.h +0 -88
- data/tracks/cpp/exercises/grade-school/require_equal_containers.h +0 -88
- data/tracks/cpp/exercises/nucleotide-count/require_equal_containers.h +0 -88
- data/tracks/cpp/exercises/series/require_equal_containers.h +0 -88
- data/tracks/cpp/exercises/word-count/require_equal_containers.h +0 -88
- data/tracks/javascript/exercises/acronym/package.json +0 -12
- data/tracks/javascript/package.json +0 -12
@@ -2,9 +2,9 @@
|
|
2
2
|
#define BOOST_TEST_MAIN
|
3
3
|
#include <boost/test/unit_test.hpp>
|
4
4
|
#include <stdexcept>
|
5
|
-
#include "require_equal_containers.h"
|
6
5
|
|
7
6
|
using namespace std;
|
7
|
+
namespace tt = boost::test_tools;
|
8
8
|
|
9
9
|
BOOST_AUTO_TEST_CASE(short_digits)
|
10
10
|
{
|
@@ -12,7 +12,7 @@ BOOST_AUTO_TEST_CASE(short_digits)
|
|
12
12
|
|
13
13
|
const vector<int> actual{series::digits("012345")};
|
14
14
|
|
15
|
-
|
15
|
+
BOOST_TEST(expected == actual, tt::per_element());
|
16
16
|
}
|
17
17
|
|
18
18
|
#if defined(EXERCISM_RUN_ALL_TESTS)
|
@@ -22,7 +22,7 @@ BOOST_AUTO_TEST_CASE(long_digits)
|
|
22
22
|
|
23
23
|
const vector<int> actual{series::digits("0123456789")};
|
24
24
|
|
25
|
-
|
25
|
+
BOOST_TEST(expected == actual, tt::per_element());
|
26
26
|
}
|
27
27
|
|
28
28
|
BOOST_AUTO_TEST_CASE(keeps_the_digit_order_if_reversed)
|
@@ -31,7 +31,7 @@ BOOST_AUTO_TEST_CASE(keeps_the_digit_order_if_reversed)
|
|
31
31
|
|
32
32
|
const vector<int> actual{series::digits("9876543210")};
|
33
33
|
|
34
|
-
|
34
|
+
BOOST_TEST(expected == actual, tt::per_element());
|
35
35
|
}
|
36
36
|
|
37
37
|
BOOST_AUTO_TEST_CASE(keeps_arbitrary_digit_order)
|
@@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(keeps_arbitrary_digit_order)
|
|
40
40
|
|
41
41
|
const vector<int> actual{series::digits("936923468")};
|
42
42
|
|
43
|
-
|
43
|
+
BOOST_TEST(expected == actual, tt::per_element());
|
44
44
|
}
|
45
45
|
|
46
46
|
BOOST_AUTO_TEST_CASE(can_slice_by_1)
|
@@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(can_slice_by_1)
|
|
49
49
|
|
50
50
|
const vector<vector<int>> actual{series::slice("01234", 1)};
|
51
51
|
|
52
|
-
|
52
|
+
BOOST_TEST(expected == actual);
|
53
53
|
}
|
54
54
|
|
55
55
|
BOOST_AUTO_TEST_CASE(can_slice_by_2)
|
@@ -58,7 +58,7 @@ BOOST_AUTO_TEST_CASE(can_slice_by_2)
|
|
58
58
|
|
59
59
|
const vector<vector<int>> actual{series::slice("98273463", 2)};
|
60
60
|
|
61
|
-
|
61
|
+
BOOST_TEST(expected == actual);
|
62
62
|
}
|
63
63
|
|
64
64
|
BOOST_AUTO_TEST_CASE(can_slice_by_3)
|
@@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE(can_slice_by_3)
|
|
67
67
|
|
68
68
|
const vector<vector<int>> actual{series::slice("01234", 3)};
|
69
69
|
|
70
|
-
|
70
|
+
BOOST_TEST(expected == actual);
|
71
71
|
}
|
72
72
|
|
73
73
|
BOOST_AUTO_TEST_CASE(can_slice_by_3_with_duplicate_digits)
|
@@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(can_slice_by_3_with_duplicate_digits)
|
|
76
76
|
|
77
77
|
const vector<vector<int>> actual{series::slice("31001", 3)};
|
78
78
|
|
79
|
-
|
79
|
+
BOOST_TEST(expected == actual);
|
80
80
|
}
|
81
81
|
|
82
82
|
BOOST_AUTO_TEST_CASE(can_slice_by_4)
|
@@ -85,7 +85,7 @@ BOOST_AUTO_TEST_CASE(can_slice_by_4)
|
|
85
85
|
|
86
86
|
const vector<vector<int>> actual{series::slice("31001", 3)};
|
87
87
|
|
88
|
-
|
88
|
+
BOOST_TEST(expected == actual);
|
89
89
|
}
|
90
90
|
|
91
91
|
BOOST_AUTO_TEST_CASE(can_slice_by_5)
|
@@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(can_slice_by_5)
|
|
94
94
|
|
95
95
|
const vector<vector<int>> actual{series::slice("81228", 5)};
|
96
96
|
|
97
|
-
|
97
|
+
BOOST_TEST(expected == actual);
|
98
98
|
}
|
99
99
|
|
100
100
|
BOOST_AUTO_TEST_CASE(domain_error_if_not_enough_digits_to_slice)
|
@@ -11,7 +11,7 @@ project(${exercise} CXX)
|
|
11
11
|
set(Boost_USE_STATIC_LIBS ON)
|
12
12
|
set(Boost_USE_MULTITHREADED ON)
|
13
13
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
14
|
-
find_package(Boost 1.
|
14
|
+
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
|
15
15
|
|
16
16
|
# Enable C++11 features on gcc/clang
|
17
17
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
|
@@ -33,15 +33,8 @@ else()
|
|
33
33
|
set(exercise_cpp "")
|
34
34
|
endif()
|
35
35
|
|
36
|
-
# Include a test helper header if it exists
|
37
|
-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
|
38
|
-
set(test_helper require_equal_containers.h)
|
39
|
-
else()
|
40
|
-
set(test_helper "")
|
41
|
-
endif()
|
42
|
-
|
43
36
|
# Build executable from sources and headers
|
44
|
-
add_executable(${exercise} ${file}_test.cpp ${
|
37
|
+
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
|
45
38
|
|
46
39
|
# We need boost includes
|
47
40
|
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
|
@@ -11,7 +11,7 @@ project(${exercise} CXX)
|
|
11
11
|
set(Boost_USE_STATIC_LIBS ON)
|
12
12
|
set(Boost_USE_MULTITHREADED ON)
|
13
13
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
14
|
-
find_package(Boost 1.
|
14
|
+
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
|
15
15
|
|
16
16
|
# Enable C++11 features on gcc/clang
|
17
17
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
|
@@ -33,15 +33,8 @@ else()
|
|
33
33
|
set(exercise_cpp "")
|
34
34
|
endif()
|
35
35
|
|
36
|
-
# Include a test helper header if it exists
|
37
|
-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
|
38
|
-
set(test_helper require_equal_containers.h)
|
39
|
-
else()
|
40
|
-
set(test_helper "")
|
41
|
-
endif()
|
42
|
-
|
43
36
|
# Build executable from sources and headers
|
44
|
-
add_executable(${exercise} ${file}_test.cpp ${
|
37
|
+
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
|
45
38
|
|
46
39
|
# We need boost includes
|
47
40
|
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
|
@@ -11,7 +11,7 @@ project(${exercise} CXX)
|
|
11
11
|
set(Boost_USE_STATIC_LIBS ON)
|
12
12
|
set(Boost_USE_MULTITHREADED ON)
|
13
13
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
14
|
-
find_package(Boost 1.
|
14
|
+
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
|
15
15
|
|
16
16
|
# Enable C++11 features on gcc/clang
|
17
17
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
|
@@ -33,15 +33,8 @@ else()
|
|
33
33
|
set(exercise_cpp "")
|
34
34
|
endif()
|
35
35
|
|
36
|
-
# Include a test helper header if it exists
|
37
|
-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
|
38
|
-
set(test_helper require_equal_containers.h)
|
39
|
-
else()
|
40
|
-
set(test_helper "")
|
41
|
-
endif()
|
42
|
-
|
43
36
|
# Build executable from sources and headers
|
44
|
-
add_executable(${exercise} ${file}_test.cpp ${
|
37
|
+
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
|
45
38
|
|
46
39
|
# We need boost includes
|
47
40
|
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
|
@@ -11,7 +11,7 @@ project(${exercise} CXX)
|
|
11
11
|
set(Boost_USE_STATIC_LIBS ON)
|
12
12
|
set(Boost_USE_MULTITHREADED ON)
|
13
13
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
14
|
-
find_package(Boost 1.
|
14
|
+
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
|
15
15
|
|
16
16
|
# Enable C++11 features on gcc/clang
|
17
17
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
|
@@ -33,15 +33,8 @@ else()
|
|
33
33
|
set(exercise_cpp "")
|
34
34
|
endif()
|
35
35
|
|
36
|
-
# Include a test helper header if it exists
|
37
|
-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
|
38
|
-
set(test_helper require_equal_containers.h)
|
39
|
-
else()
|
40
|
-
set(test_helper "")
|
41
|
-
endif()
|
42
|
-
|
43
36
|
# Build executable from sources and headers
|
44
|
-
add_executable(${exercise} ${file}_test.cpp ${
|
37
|
+
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
|
45
38
|
|
46
39
|
# We need boost includes
|
47
40
|
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
|
@@ -11,7 +11,7 @@ project(${exercise} CXX)
|
|
11
11
|
set(Boost_USE_STATIC_LIBS ON)
|
12
12
|
set(Boost_USE_MULTITHREADED ON)
|
13
13
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
14
|
-
find_package(Boost 1.
|
14
|
+
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
|
15
15
|
|
16
16
|
# Enable C++11 features on gcc/clang
|
17
17
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
|
@@ -33,15 +33,8 @@ else()
|
|
33
33
|
set(exercise_cpp "")
|
34
34
|
endif()
|
35
35
|
|
36
|
-
# Include a test helper header if it exists
|
37
|
-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
|
38
|
-
set(test_helper require_equal_containers.h)
|
39
|
-
else()
|
40
|
-
set(test_helper "")
|
41
|
-
endif()
|
42
|
-
|
43
36
|
# Build executable from sources and headers
|
44
|
-
add_executable(${exercise} ${file}_test.cpp ${
|
37
|
+
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
|
45
38
|
|
46
39
|
# We need boost includes
|
47
40
|
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
|
@@ -11,7 +11,7 @@ project(${exercise} CXX)
|
|
11
11
|
set(Boost_USE_STATIC_LIBS ON)
|
12
12
|
set(Boost_USE_MULTITHREADED ON)
|
13
13
|
set(Boost_USE_STATIC_RUNTIME OFF)
|
14
|
-
find_package(Boost 1.
|
14
|
+
find_package(Boost 1.59 REQUIRED COMPONENTS unit_test_framework date_time regex)
|
15
15
|
|
16
16
|
# Enable C++11 features on gcc/clang
|
17
17
|
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
|
@@ -33,15 +33,8 @@ else()
|
|
33
33
|
set(exercise_cpp "")
|
34
34
|
endif()
|
35
35
|
|
36
|
-
# Include a test helper header if it exists
|
37
|
-
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/require_equal_containers.h)
|
38
|
-
set(test_helper require_equal_containers.h)
|
39
|
-
else()
|
40
|
-
set(test_helper "")
|
41
|
-
endif()
|
42
|
-
|
43
36
|
# Build executable from sources and headers
|
44
|
-
add_executable(${exercise} ${file}_test.cpp ${
|
37
|
+
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h)
|
45
38
|
|
46
39
|
# We need boost includes
|
47
40
|
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
|
@@ -2,7 +2,6 @@
|
|
2
2
|
#define BOOST_TEST_MAIN
|
3
3
|
#include <boost/test/unit_test.hpp>
|
4
4
|
#include <map>
|
5
|
-
#include "require_equal_containers.h"
|
6
5
|
|
7
6
|
using namespace std;
|
8
7
|
|
@@ -12,7 +11,7 @@ BOOST_AUTO_TEST_CASE(counts_one_word)
|
|
12
11
|
|
13
12
|
const auto actual = word_count::words("word");
|
14
13
|
|
15
|
-
|
14
|
+
BOOST_TEST(expected == actual);
|
16
15
|
}
|
17
16
|
|
18
17
|
#if defined(EXERCISM_RUN_ALL_TESTS)
|
@@ -22,7 +21,7 @@ BOOST_AUTO_TEST_CASE(counts_one_of_each)
|
|
22
21
|
|
23
22
|
const auto actual = word_count::words("one of each");
|
24
23
|
|
25
|
-
|
24
|
+
BOOST_TEST(expected == actual);
|
26
25
|
}
|
27
26
|
|
28
27
|
BOOST_AUTO_TEST_CASE(counts_multiple_occurrences)
|
@@ -31,7 +30,7 @@ BOOST_AUTO_TEST_CASE(counts_multiple_occurrences)
|
|
31
30
|
|
32
31
|
const auto actual = word_count::words("one fish two fish red fish blue fish");
|
33
32
|
|
34
|
-
|
33
|
+
BOOST_TEST(expected == actual);
|
35
34
|
}
|
36
35
|
|
37
36
|
BOOST_AUTO_TEST_CASE(ignores_punctuation)
|
@@ -40,7 +39,7 @@ BOOST_AUTO_TEST_CASE(ignores_punctuation)
|
|
40
39
|
|
41
40
|
const auto actual = word_count::words("car : carpet as java : javascript!!&@$%^&");
|
42
41
|
|
43
|
-
|
42
|
+
BOOST_TEST(expected == actual);
|
44
43
|
}
|
45
44
|
|
46
45
|
BOOST_AUTO_TEST_CASE(includes_numbers)
|
@@ -49,7 +48,7 @@ BOOST_AUTO_TEST_CASE(includes_numbers)
|
|
49
48
|
|
50
49
|
const auto actual = word_count::words("testing, 1, 2 testing");
|
51
50
|
|
52
|
-
|
51
|
+
BOOST_TEST(expected == actual);
|
53
52
|
}
|
54
53
|
|
55
54
|
BOOST_AUTO_TEST_CASE(normalizes_case)
|
@@ -58,7 +57,7 @@ BOOST_AUTO_TEST_CASE(normalizes_case)
|
|
58
57
|
|
59
58
|
const auto actual = word_count::words("go Go GO");
|
60
59
|
|
61
|
-
|
60
|
+
BOOST_TEST(expected == actual);
|
62
61
|
}
|
63
62
|
|
64
63
|
BOOST_AUTO_TEST_CASE(counts_constructor)
|
@@ -67,7 +66,7 @@ BOOST_AUTO_TEST_CASE(counts_constructor)
|
|
67
66
|
|
68
67
|
const auto actual = word_count::words("constructor Constructor");
|
69
68
|
|
70
|
-
|
69
|
+
BOOST_TEST(expected == actual);
|
71
70
|
}
|
72
71
|
|
73
72
|
BOOST_AUTO_TEST_CASE(counts_multiline)
|
@@ -76,15 +75,15 @@ BOOST_AUTO_TEST_CASE(counts_multiline)
|
|
76
75
|
|
77
76
|
const auto actual = word_count::words("hello\nworld");
|
78
77
|
|
79
|
-
|
78
|
+
BOOST_TEST(expected == actual);
|
80
79
|
}
|
81
80
|
|
82
81
|
BOOST_AUTO_TEST_CASE(count_everything_just_once)
|
83
82
|
{
|
84
83
|
const map<string, int> expected{{"all", 2}, {"the", 2}, {"kings", 2}, {"horses", 1}, {"and", 1}, {"men", 1}};
|
85
84
|
const auto actual = word_count::words("all the kings horses and all the kings men");
|
86
|
-
|
87
|
-
|
85
|
+
|
86
|
+
BOOST_TEST(expected == actual);
|
88
87
|
}
|
89
88
|
|
90
89
|
BOOST_AUTO_TEST_CASE(handles_cramped_list)
|
@@ -92,7 +91,7 @@ BOOST_AUTO_TEST_CASE(handles_cramped_list)
|
|
92
91
|
const map<string, int> expected{{"one", 1}, {"two", 1}, {"three", 1}};
|
93
92
|
const auto actual = word_count::words("one,two,three");
|
94
93
|
|
95
|
-
|
94
|
+
BOOST_TEST(expected == actual);
|
96
95
|
}
|
97
96
|
|
98
97
|
BOOST_AUTO_TEST_CASE(with_apostrophes)
|
@@ -100,7 +99,7 @@ BOOST_AUTO_TEST_CASE(with_apostrophes)
|
|
100
99
|
const map<string, int> expected{{"first", 1}, {"don't", 2}, {"laugh", 1}, {"then", 1}, {"cry", 1}};
|
101
100
|
const auto actual = word_count::words("First: don't laugh. Then: don't cry.");
|
102
101
|
|
103
|
-
|
102
|
+
BOOST_TEST(expected == actual);
|
104
103
|
}
|
105
104
|
|
106
105
|
BOOST_AUTO_TEST_CASE(with_free_standing_apostrophes)
|
@@ -108,7 +107,7 @@ BOOST_AUTO_TEST_CASE(with_free_standing_apostrophes)
|
|
108
107
|
const map<string, int> expected{{ "go", 3 }};
|
109
108
|
const auto actual = word_count::words("go ' Go '' GO");
|
110
109
|
|
111
|
-
|
110
|
+
BOOST_TEST(expected == actual);
|
112
111
|
}
|
113
112
|
|
114
113
|
BOOST_AUTO_TEST_CASE(with_apostrophes_as_quotes)
|
@@ -116,6 +115,6 @@ BOOST_AUTO_TEST_CASE(with_apostrophes_as_quotes)
|
|
116
115
|
const map<string, int> expected{{"she", 1}, {"said", 1}, {"let's", 1}, {"meet", 1}, {"at", 1}, {"twelve", 1}, {"o'clock", 1}};
|
117
116
|
const auto actual = word_count::words("She said, 'let's meet at twelve o'clock'");
|
118
117
|
|
119
|
-
|
118
|
+
BOOST_TEST(expected == actual);
|
120
119
|
}
|
121
120
|
#endif
|
data/tracks/go/README.md
CHANGED
@@ -59,28 +59,42 @@ $ tree -a
|
|
59
59
|
This list of files can vary across exercises so let's quickly run through
|
60
60
|
each file and briefly describe what it is.
|
61
61
|
|
62
|
-
**cases_test.go** - This file contains [generated test cases](#generating-test-cases),
|
63
|
-
and will only be present in some exercises.
|
62
|
+
* **cases_test.go** - This file contains [generated test cases](#generating-test-cases),
|
63
|
+
and will only be present in some exercises.
|
64
64
|
|
65
|
-
**example.go** - This is a reference solution for the exercise. This file is
|
66
|
-
ignored by the `exercism fetch` command
|
67
|
-
|
65
|
+
* **example.go** - This is a reference solution for the exercise. This file is
|
66
|
+
ignored by the `exercism fetch` command. See [ignored files](#ignored-files) for
|
67
|
+
details on which files are ignored.
|
68
68
|
|
69
|
-
**leap.go** - This is a *stub file*, and will only be present in some exercises.
|
69
|
+
* **leap.go** - This is a *stub file*, and will only be present in some exercises.
|
70
70
|
|
71
|
-
**leap_test.go** - This is the main test file for the exercise.
|
71
|
+
* **leap_test.go** - This is the main test file for the exercise.
|
72
72
|
|
73
|
-
**.meta/** - The *.meta* directory
|
74
|
-
|
75
|
-
|
73
|
+
* **.meta/** - The *.meta* directory contains files that are not meant to be
|
74
|
+
included when a user fetches an exercise, for instance test case generators.
|
75
|
+
See [ignored files](#ignored-files) for details on which files are ignored.
|
76
76
|
|
77
|
-
**gen.go** - This file, within the *.meta* directory, generates the *cases_test.go*
|
78
|
-
file, and will only be present in some exercises. See [generating test cases](#generating-test-cases)
|
79
|
-
for more information.
|
77
|
+
* **gen.go** - This file, within the *.meta* directory, generates the *cases_test.go*
|
78
|
+
file, and will only be present in some exercises. See [generating test cases](#generating-test-cases)
|
79
|
+
for more information.
|
80
80
|
|
81
81
|
In some exercises there can be extra files, for instance the `series` exercise
|
82
82
|
contains extra test files.
|
83
83
|
|
84
|
+
### Ignored files
|
85
|
+
|
86
|
+
When a user fetches an exercise, they do not need to get all the files within an
|
87
|
+
exercise directory. For instance; the *example.go* files that contain an
|
88
|
+
example solution, or the *gen.go* files used to generate an exercise's test
|
89
|
+
cases. Therefore there are certain files and directories that are ignored when
|
90
|
+
an exercise is fetched. These are:
|
91
|
+
|
92
|
+
* The *.meta* directory and anything within it.
|
93
|
+
* Any file that matches the `ignore_pattern` defined in the [config.json file](/config.json).
|
94
|
+
This currently matches any filename that contains the word `example`, **unless**
|
95
|
+
it is followed by the word `test`, with any number of characters inbetween.
|
96
|
+
|
97
|
+
|
84
98
|
### Example solutions
|
85
99
|
|
86
100
|
*example.go* is a reference solution. It is a valid solution that [Travis](https://travis-ci.org/exercism/xgo),
|
data/tracks/go/config.json
CHANGED
@@ -32,9 +32,7 @@ type js struct {
|
|
32
32
|
// template applied to above data structure generates the Go test cases
|
33
33
|
var tmpl = `package connect
|
34
34
|
|
35
|
-
|
36
|
-
{{if .Commit}}// Commit: {{.Commit}}
|
37
|
-
{{end}}
|
35
|
+
{{.Header}}
|
38
36
|
|
39
37
|
var testCases = []struct {
|
40
38
|
description string
|