trackler 2.2.1.46 → 2.2.1.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/nucleotide-count/canonical-data.json +7 -7
- data/tracks/c/README.md +1 -1
- data/tracks/c/docs/SNIPPET.txt +2 -3
- data/tracks/c/exercises/acronym/test/test_acronym.c +8 -0
- data/tracks/c/exercises/all-your-base/test/test_all_your_base.c +8 -0
- data/tracks/c/exercises/allergies/test/test_allergies.c +8 -0
- data/tracks/c/exercises/anagram/test/test_anagram.c +8 -0
- data/tracks/c/exercises/atbash-cipher/test/test_atbash_cipher.c +8 -0
- data/tracks/c/exercises/beer-song/src/example.c +23 -22
- data/tracks/c/exercises/beer-song/src/example.h +3 -3
- data/tracks/c/exercises/beer-song/test/test_beer_song.c +8 -0
- data/tracks/c/exercises/binary-search/test/test_binary_search.c +8 -0
- data/tracks/c/exercises/binary/test/test_binary.c +8 -0
- data/tracks/c/exercises/bob/test/test_bob.c +8 -0
- data/tracks/c/exercises/clock/test/test_clock.c +8 -0
- data/tracks/c/exercises/difference-of-squares/test/test_difference_of_squares.c +8 -0
- data/tracks/c/exercises/gigasecond/test/test_gigasecond.c +8 -0
- data/tracks/c/exercises/grains/test/test_grains.c +8 -0
- data/tracks/c/exercises/hamming/test/test_hamming.c +8 -0
- data/tracks/c/exercises/hello-world/src/example.c +0 -2
- data/tracks/c/exercises/hello-world/test/test_hello_world.c +8 -0
- data/tracks/c/exercises/isogram/test/test_isogram.c +8 -0
- data/tracks/c/exercises/largest-series-product/test/test_largest_series_product.c +8 -0
- data/tracks/c/exercises/leap/test/test_leap.c +8 -0
- data/tracks/c/exercises/meetup/test/test_meetup.c +8 -0
- data/tracks/c/exercises/nth-prime/test/test_nth_prime.c +8 -0
- data/tracks/c/exercises/nucleotide-count/test/test_nucleotide_count.c +8 -0
- data/tracks/c/exercises/palindrome-products/test/test_palindrome_products.c +8 -0
- data/tracks/c/exercises/pangram/test/test_pangram.c +8 -0
- data/tracks/c/exercises/pascals-triangle/test/test_pascals_triangle.c +8 -0
- data/tracks/c/exercises/perfect-numbers/src/example.c +4 -4
- data/tracks/c/exercises/perfect-numbers/src/example.h +4 -4
- data/tracks/c/exercises/perfect-numbers/src/perfect_numbers.h +4 -4
- data/tracks/c/exercises/perfect-numbers/test/test_perfect_numbers.c +23 -13
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +8 -0
- data/tracks/c/exercises/raindrops/test/test_raindrops.c +5 -1
- data/tracks/c/exercises/react/src/example.c +8 -8
- data/tracks/c/exercises/react/test/test_react.c +8 -0
- data/tracks/c/exercises/rna-transcription/test/test_rna_transcription.c +8 -0
- data/tracks/c/exercises/robot-simulator/src/example.c +12 -12
- data/tracks/c/exercises/robot-simulator/src/robot_simulator.h +11 -11
- data/tracks/c/exercises/robot-simulator/test/test_robot_simulator.c +33 -25
- data/tracks/c/exercises/roman-numerals/test/test_roman_numerals.c +8 -0
- data/tracks/c/exercises/scrabble-score/test/test_scrabble_score.c +8 -0
- data/tracks/c/exercises/series/test/test_series.c +8 -0
- data/tracks/c/exercises/sieve/test/test_sieve.c +8 -0
- data/tracks/c/exercises/space-age/src/example.h +8 -8
- data/tracks/c/exercises/space-age/test/test_space_age.c +16 -8
- data/tracks/c/exercises/sum-of-multiples/test/test_sum_of_multiples.c +8 -0
- data/tracks/c/exercises/triangle/test/test_triangle.c +8 -0
- data/tracks/c/exercises/word-count/test/test_word_count.c +8 -0
- data/tracks/cfml/config.json +8 -0
- data/tracks/cfml/exercises/anagram/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/anagram/Anagram.cfc +13 -0
- data/tracks/cfml/exercises/anagram/AnagramTest.cfc +79 -0
- data/tracks/cfml/exercises/anagram/README.md +29 -0
- data/tracks/cfml/exercises/anagram/Solution.cfc +42 -0
- data/tracks/cfml/exercises/anagram/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/anagram/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/anagram/box.json +8 -0
- data/tracks/cfml/exercises/anagram/index.cfm +37 -0
- data/tracks/common-lisp/config.json +5 -5
- data/tracks/csharp/exercises/two-bucket/Example.cs +53 -79
- data/tracks/csharp/exercises/two-bucket/TwoBucketTest.cs +2 -2
- data/tracks/csharp/generators/Exercises/QueenAttack.cs +3 -3
- data/tracks/dart/exercises/leap/test/leap_test.dart +1 -1
- data/tracks/delphi/exercises/hamming/uHammingTests.pas +2 -2
- data/tracks/delphi/exercises/leap/uLeapTests.pas +11 -38
- data/tracks/delphi/exercises/nucleotide-count/uNucleotideCountExample.pas +1 -1
- data/tracks/delphi/exercises/nucleotide-count/uNucleotideCountTest.pas +31 -55
- data/tracks/ecmascript/config.json +31 -0
- data/tracks/ecmascript/config/maintainers.json +5 -5
- data/tracks/ecmascript/exercises/accumulate/package.json +1 -1
- data/tracks/ecmascript/exercises/acronym/package.json +1 -1
- data/tracks/ecmascript/exercises/all-your-base/package.json +1 -1
- data/tracks/ecmascript/exercises/allergies/package.json +1 -1
- data/tracks/ecmascript/exercises/alphametics/package.json +1 -1
- data/tracks/ecmascript/exercises/anagram/package.json +1 -1
- data/tracks/ecmascript/exercises/atbash-cipher/package.json +1 -1
- data/tracks/ecmascript/exercises/beer-song/package.json +1 -1
- data/tracks/ecmascript/exercises/binary-search-tree/package.json +1 -1
- data/tracks/ecmascript/exercises/binary-search/package.json +1 -1
- data/tracks/ecmascript/exercises/binary/package.json +1 -1
- data/tracks/ecmascript/exercises/bob/package.json +1 -1
- data/tracks/ecmascript/exercises/bracket-push/package.json +1 -1
- data/tracks/ecmascript/exercises/circular-buffer/package.json +1 -1
- data/tracks/ecmascript/exercises/clock/package.json +1 -1
- data/tracks/ecmascript/exercises/collatz-conjecture/README.md +59 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/collatz-conjecture.spec.js +31 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/example.js +14 -0
- data/tracks/ecmascript/exercises/collatz-conjecture/package.json +69 -0
- data/tracks/ecmascript/exercises/connect/package.json +1 -1
- data/tracks/ecmascript/exercises/crypto-square/package.json +1 -1
- data/tracks/ecmascript/exercises/custom-set/package.json +1 -1
- data/tracks/ecmascript/exercises/diamond/package.json +1 -1
- data/tracks/ecmascript/exercises/difference-of-squares/package.json +1 -1
- data/tracks/ecmascript/exercises/diffie-hellman/package.json +1 -1
- data/tracks/ecmascript/exercises/etl/package.json +1 -1
- data/tracks/ecmascript/exercises/flatten-array/package.json +1 -1
- data/tracks/ecmascript/exercises/food-chain/package.json +1 -1
- data/tracks/ecmascript/exercises/gigasecond/package.json +1 -1
- data/tracks/ecmascript/exercises/grade-school/package.json +1 -1
- data/tracks/ecmascript/exercises/grains/package.json +1 -1
- data/tracks/ecmascript/exercises/hamming/package.json +1 -1
- data/tracks/ecmascript/exercises/hello-world/package.json +1 -1
- data/tracks/ecmascript/exercises/hexadecimal/package.json +1 -1
- data/tracks/ecmascript/exercises/isogram/package.json +1 -1
- data/tracks/ecmascript/exercises/kindergarten-garden/package.json +1 -1
- data/tracks/ecmascript/exercises/largest-series-product/package.json +1 -1
- data/tracks/ecmascript/exercises/leap/package.json +1 -1
- data/tracks/ecmascript/exercises/linked-list/package.json +1 -1
- data/tracks/ecmascript/exercises/list-ops/package.json +1 -1
- data/tracks/ecmascript/exercises/luhn/package.json +1 -1
- data/tracks/ecmascript/exercises/matrix/package.json +1 -1
- data/tracks/ecmascript/exercises/meetup/package.json +1 -1
- data/tracks/ecmascript/exercises/minesweeper/package.json +1 -1
- data/tracks/ecmascript/exercises/nth-prime/package.json +1 -1
- data/tracks/ecmascript/exercises/ocr-numbers/package.json +1 -1
- data/tracks/ecmascript/exercises/octal/package.json +1 -1
- data/tracks/ecmascript/exercises/palindrome-products/package.json +1 -1
- data/tracks/ecmascript/exercises/pangram/package.json +1 -1
- data/tracks/ecmascript/exercises/pascals-triangle/package.json +1 -1
- data/tracks/ecmascript/exercises/perfect-numbers/package.json +1 -1
- data/tracks/ecmascript/exercises/phone-number/package.json +1 -1
- data/tracks/ecmascript/exercises/pig-latin/package.json +1 -1
- data/tracks/ecmascript/exercises/prime-factors/package.json +1 -1
- data/tracks/ecmascript/exercises/proverb/package.json +1 -1
- data/tracks/ecmascript/exercises/pythagorean-triplet/package.json +1 -1
- data/tracks/ecmascript/exercises/queen-attack/package.json +1 -1
- data/tracks/ecmascript/exercises/raindrops/package.json +1 -1
- data/tracks/ecmascript/exercises/rna-transcription/package.json +1 -1
- data/tracks/ecmascript/exercises/robot-name/package.json +1 -1
- data/tracks/ecmascript/exercises/robot-simulator/package.json +1 -1
- data/tracks/ecmascript/exercises/roman-numerals/package.json +1 -1
- data/tracks/ecmascript/exercises/run-length-encoding/package.json +1 -1
- data/tracks/ecmascript/exercises/saddle-points/package.json +1 -1
- data/tracks/ecmascript/exercises/say/package.json +1 -1
- data/tracks/ecmascript/exercises/scrabble-score/package.json +1 -1
- data/tracks/ecmascript/exercises/secret-handshake/package.json +1 -1
- data/tracks/ecmascript/exercises/series/package.json +1 -1
- data/tracks/ecmascript/exercises/sieve/package.json +1 -1
- data/tracks/ecmascript/exercises/simple-cipher/package.json +1 -1
- data/tracks/ecmascript/exercises/simple-linked-list/package.json +1 -1
- data/tracks/ecmascript/exercises/space-age/package.json +1 -1
- data/tracks/ecmascript/exercises/strain/package.json +1 -1
- data/tracks/ecmascript/exercises/sublist/package.json +1 -1
- data/tracks/ecmascript/exercises/sum-of-multiples/package.json +1 -1
- data/tracks/ecmascript/exercises/triangle/package.json +1 -1
- data/tracks/ecmascript/exercises/trinary/package.json +1 -1
- data/tracks/ecmascript/exercises/twelve-days/package.json +1 -1
- data/tracks/ecmascript/exercises/two-bucket/package.json +1 -1
- data/tracks/ecmascript/exercises/word-count/package.json +1 -1
- data/tracks/ecmascript/exercises/word-search/README.md +58 -0
- data/tracks/ecmascript/exercises/word-search/example.js +146 -0
- data/tracks/ecmascript/exercises/word-search/package.json +69 -0
- data/tracks/ecmascript/exercises/word-search/word-search.spec.js +626 -0
- data/tracks/ecmascript/exercises/wordy/package.json +1 -1
- data/tracks/ecmascript/package.json +1 -1
- data/tracks/elixir/config.json +11 -0
- data/tracks/elixir/exercises/luhn/example.exs +26 -46
- data/tracks/elixir/exercises/luhn/luhn.exs +0 -13
- data/tracks/elixir/exercises/luhn/luhn_test.exs +44 -14
- data/tracks/elixir/exercises/transpose/README.md +101 -0
- data/tracks/elixir/exercises/transpose/example.exs +46 -0
- data/tracks/elixir/exercises/transpose/transpose.exs +22 -0
- data/tracks/elixir/exercises/transpose/transpose_test.exs +248 -0
- data/tracks/fsharp/exercises/grains/Example.fs +10 -2
- data/tracks/fsharp/exercises/grains/Grains.fs +2 -4
- data/tracks/fsharp/exercises/grains/GrainsTest.fs +52 -25
- data/tracks/fsharp/exercises/phone-number/Example.fs +11 -3
- data/tracks/fsharp/exercises/phone-number/PhoneNumber.fs +1 -1
- data/tracks/fsharp/exercises/phone-number/PhoneNumberTest.fs +32 -21
- data/tracks/fsharp/exercises/prime-factors/Example.fs +6 -13
- data/tracks/fsharp/exercises/prime-factors/PrimeFactors.fs +1 -1
- data/tracks/fsharp/exercises/prime-factors/PrimeFactorsTest.fs +23 -32
- data/tracks/fsharp/exercises/rail-fence-cipher/RailFenceCipherTest.fs +22 -13
- data/tracks/fsharp/generators/Exercise.fs +3 -4
- data/tracks/fsharp/generators/Generators.fs +31 -0
- data/tracks/gnu-apl/bin/run-all-tests +5 -2
- data/tracks/java/CONTRIBUTING.md +8 -0
- data/tracks/java/POLICIES.md +2 -2
- data/tracks/java/config.json +26 -4
- data/tracks/java/exercises/triangle/.meta/.version +1 -0
- data/tracks/java/exercises/triangle/.meta/src/reference/java/Triangle.java +1 -1
- data/tracks/java/exercises/triangle/src/test/java/TriangleTest.java +59 -40
- data/tracks/javascript/config.json +30 -0
- data/tracks/javascript/config/maintainers.json +8 -8
- data/tracks/javascript/exercises/change/example.js +6 -22
- data/tracks/javascript/exercises/collatz-conjecture/README.md +57 -0
- data/tracks/javascript/exercises/collatz-conjecture/collatz-conjecture.spec.js +37 -0
- data/tracks/javascript/exercises/collatz-conjecture/example.js +20 -0
- data/tracks/javascript/exercises/protein-translation/example.js +30 -31
- data/tracks/javascript/exercises/protein-translation/protein-translation.spec.js +60 -60
- data/tracks/javascript/exercises/transpose/README.md +89 -0
- data/tracks/javascript/exercises/transpose/example.js +17 -0
- data/tracks/javascript/exercises/transpose/transpose.spec.js +67 -0
- data/tracks/objective-c/config.json +283 -263
- data/tracks/objective-c/exercises/grains/GrainsExample.h +6 -0
- data/tracks/objective-c/exercises/grains/GrainsExample.m +19 -0
- data/tracks/objective-c/exercises/grains/GrainsTest.m +85 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeExample.h +6 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeExample.m +39 -0
- data/tracks/objective-c/exercises/nth-prime/NthPrimeTest.m +53 -0
- data/tracks/python/config.json +42 -11
- data/tracks/python/exercises/change/README.md +34 -0
- data/tracks/python/exercises/two-bucket/README.md +47 -0
- data/tracks/ruby/README.md +4 -1
- data/tracks/ruby/lib/generator/command_line.rb +3 -3
- data/tracks/ruby/lib/generator/command_line/generator_optparser.rb +3 -3
- data/tracks/ruby/test/generator/command_line/generator_optparser_test.rb +4 -4
- data/tracks/ruby/test/generator/command_line_test.rb +5 -5
- data/tracks/typescript/config.json +15 -0
- data/tracks/typescript/exercises/strain/README.md +60 -0
- data/tracks/typescript/exercises/strain/package.json +36 -0
- data/tracks/typescript/exercises/strain/strain.example.ts +23 -0
- data/tracks/typescript/exercises/strain/strain.test.ts +76 -0
- data/tracks/typescript/exercises/strain/strain.ts +0 -0
- data/tracks/typescript/exercises/strain/tsconfig.json +22 -0
- data/tracks/typescript/exercises/strain/tslint.json +127 -0
- data/tracks/typescript/exercises/strain/yarn.lock +2305 -0
- metadata +46 -3
- data/tracks/ecmascript/package-lock.json +0 -2835
@@ -2,23 +2,23 @@
|
|
2
2
|
#define ROBOT_SIMULATOR_H
|
3
3
|
|
4
4
|
typedef enum {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
HEADING_NORTH = 0,
|
6
|
+
HEADING_EAST,
|
7
|
+
HEADING_SOUTH,
|
8
|
+
HEADING_WEST,
|
9
|
+
HEADING_MAX
|
10
10
|
} bearing_t;
|
11
11
|
|
12
12
|
enum {
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
DEFAULT_BEARING = HEADING_NORTH,
|
14
|
+
DEFAULT_X_COORDINATE = 0,
|
15
|
+
DEFAULT_Y_COORDINATE = 0,
|
16
16
|
};
|
17
17
|
|
18
18
|
enum {
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
COMMAND_LEFT = 'L',
|
20
|
+
COMMAND_RIGHT = 'R',
|
21
|
+
COMMAND_ADVANCE = 'A'
|
22
22
|
};
|
23
23
|
|
24
24
|
typedef struct robot_coordinates {
|
@@ -1,6 +1,14 @@
|
|
1
1
|
#include "../src/robot_simulator.h"
|
2
2
|
#include "vendor/unity.h"
|
3
3
|
|
4
|
+
void setUp(void)
|
5
|
+
{
|
6
|
+
}
|
7
|
+
|
8
|
+
void tearDown(void)
|
9
|
+
{
|
10
|
+
}
|
11
|
+
|
4
12
|
// Test Helper Function
|
5
13
|
void confirm_position(robot_grid_status_t * expected,
|
6
14
|
robot_grid_status_t * actual)
|
@@ -14,7 +22,7 @@ void confirm_position(robot_grid_status_t * expected,
|
|
14
22
|
void test_init(void)
|
15
23
|
{
|
16
24
|
robot_grid_status_t expected =
|
17
|
-
{
|
25
|
+
{ DEFAULT_BEARING, {DEFAULT_X_COORDINATE, DEFAULT_Y_COORDINATE} };
|
18
26
|
robot_grid_status_t actual = robot_init();
|
19
27
|
|
20
28
|
confirm_position(&expected, &actual);
|
@@ -24,9 +32,9 @@ void test_invalid_initial_heading(void)
|
|
24
32
|
{
|
25
33
|
TEST_IGNORE(); // delete this line to run test
|
26
34
|
robot_grid_status_t expected =
|
27
|
-
{
|
35
|
+
{ DEFAULT_BEARING, {DEFAULT_X_COORDINATE, DEFAULT_Y_COORDINATE} };
|
28
36
|
robot_grid_status_t actual =
|
29
|
-
robot_init_with_position(99,
|
37
|
+
robot_init_with_position(99, DEFAULT_X_COORDINATE, DEFAULT_Y_COORDINATE);
|
30
38
|
|
31
39
|
confirm_position(&expected, &actual);
|
32
40
|
}
|
@@ -34,8 +42,8 @@ void test_invalid_initial_heading(void)
|
|
34
42
|
void test_init_with_negative_positions(void)
|
35
43
|
{
|
36
44
|
TEST_IGNORE();
|
37
|
-
robot_grid_status_t expected = {
|
38
|
-
robot_grid_status_t actual = robot_init_with_position(
|
45
|
+
robot_grid_status_t expected = { HEADING_SOUTH, {-1, -1} };
|
46
|
+
robot_grid_status_t actual = robot_init_with_position(HEADING_SOUTH, -1, -1);
|
39
47
|
|
40
48
|
confirm_position(&expected, &actual);
|
41
49
|
}
|
@@ -43,21 +51,21 @@ void test_init_with_negative_positions(void)
|
|
43
51
|
void test_turn_right(void)
|
44
52
|
{
|
45
53
|
TEST_IGNORE();
|
46
|
-
robot_grid_status_t expected = {
|
54
|
+
robot_grid_status_t expected = { HEADING_EAST, {0, 0} };
|
47
55
|
robot_grid_status_t actual = robot_init();
|
48
56
|
|
49
57
|
robot_turn_right(&actual);
|
50
58
|
confirm_position(&expected, &actual);
|
51
59
|
|
52
|
-
expected.bearing =
|
60
|
+
expected.bearing = HEADING_SOUTH;
|
53
61
|
robot_turn_right(&actual);
|
54
62
|
confirm_position(&expected, &actual);
|
55
63
|
|
56
|
-
expected.bearing =
|
64
|
+
expected.bearing = HEADING_WEST;
|
57
65
|
robot_turn_right(&actual);
|
58
66
|
confirm_position(&expected, &actual);
|
59
67
|
|
60
|
-
expected.bearing =
|
68
|
+
expected.bearing = HEADING_NORTH;
|
61
69
|
robot_turn_right(&actual);
|
62
70
|
confirm_position(&expected, &actual);
|
63
71
|
}
|
@@ -65,21 +73,21 @@ void test_turn_right(void)
|
|
65
73
|
void test_turn_left(void)
|
66
74
|
{
|
67
75
|
TEST_IGNORE();
|
68
|
-
robot_grid_status_t expected = {
|
76
|
+
robot_grid_status_t expected = { HEADING_WEST, {0, 0} };
|
69
77
|
robot_grid_status_t actual = robot_init();
|
70
78
|
|
71
79
|
robot_turn_left(&actual);
|
72
80
|
confirm_position(&expected, &actual);
|
73
81
|
|
74
|
-
expected.bearing =
|
82
|
+
expected.bearing = HEADING_SOUTH;
|
75
83
|
robot_turn_left(&actual);
|
76
84
|
confirm_position(&expected, &actual);
|
77
85
|
|
78
|
-
expected.bearing =
|
86
|
+
expected.bearing = HEADING_EAST;
|
79
87
|
robot_turn_left(&actual);
|
80
88
|
confirm_position(&expected, &actual);
|
81
89
|
|
82
|
-
expected.bearing =
|
90
|
+
expected.bearing = HEADING_NORTH;
|
83
91
|
robot_turn_left(&actual);
|
84
92
|
confirm_position(&expected, &actual);
|
85
93
|
}
|
@@ -87,7 +95,7 @@ void test_turn_left(void)
|
|
87
95
|
void test_advance_positive_north(void)
|
88
96
|
{
|
89
97
|
TEST_IGNORE();
|
90
|
-
robot_grid_status_t expected = {
|
98
|
+
robot_grid_status_t expected = { HEADING_NORTH, {0, 1} };
|
91
99
|
robot_grid_status_t actual = robot_init();
|
92
100
|
|
93
101
|
robot_advance(&actual);
|
@@ -97,8 +105,8 @@ void test_advance_positive_north(void)
|
|
97
105
|
void test_advance_positive_east(void)
|
98
106
|
{
|
99
107
|
TEST_IGNORE();
|
100
|
-
robot_grid_status_t expected = {
|
101
|
-
robot_grid_status_t actual = robot_init_with_position(
|
108
|
+
robot_grid_status_t expected = { HEADING_EAST, {1, 0} };
|
109
|
+
robot_grid_status_t actual = robot_init_with_position(HEADING_EAST, 0, 0);
|
102
110
|
|
103
111
|
robot_advance(&actual);
|
104
112
|
confirm_position(&expected, &actual);
|
@@ -107,8 +115,8 @@ void test_advance_positive_east(void)
|
|
107
115
|
void test_advance_negative_south(void)
|
108
116
|
{
|
109
117
|
TEST_IGNORE();
|
110
|
-
robot_grid_status_t expected = {
|
111
|
-
robot_grid_status_t actual = robot_init_with_position(
|
118
|
+
robot_grid_status_t expected = { HEADING_SOUTH, {0, -1} };
|
119
|
+
robot_grid_status_t actual = robot_init_with_position(HEADING_SOUTH, 0, 0);
|
112
120
|
|
113
121
|
robot_advance(&actual);
|
114
122
|
confirm_position(&expected, &actual);
|
@@ -117,8 +125,8 @@ void test_advance_negative_south(void)
|
|
117
125
|
void test_advance_negative_west(void)
|
118
126
|
{
|
119
127
|
TEST_IGNORE();
|
120
|
-
robot_grid_status_t expected = {
|
121
|
-
robot_grid_status_t actual = robot_init_with_position(
|
128
|
+
robot_grid_status_t expected = { HEADING_WEST, {-1, 0} };
|
129
|
+
robot_grid_status_t actual = robot_init_with_position(HEADING_WEST, 0, 0);
|
122
130
|
|
123
131
|
robot_advance(&actual);
|
124
132
|
confirm_position(&expected, &actual);
|
@@ -127,7 +135,7 @@ void test_advance_negative_west(void)
|
|
127
135
|
void test_simulate_move_west_and_north(void)
|
128
136
|
{
|
129
137
|
TEST_IGNORE();
|
130
|
-
robot_grid_status_t expected = {
|
138
|
+
robot_grid_status_t expected = { HEADING_WEST, {-4, 1} };
|
131
139
|
robot_grid_status_t actual = robot_init();
|
132
140
|
|
133
141
|
robot_simulator(&actual, "LAAARALA");
|
@@ -137,8 +145,8 @@ void test_simulate_move_west_and_north(void)
|
|
137
145
|
void test_simulate_move_west_and_south(void)
|
138
146
|
{
|
139
147
|
TEST_IGNORE();
|
140
|
-
robot_grid_status_t expected = {
|
141
|
-
robot_grid_status_t actual = robot_init_with_position(
|
148
|
+
robot_grid_status_t expected = { HEADING_SOUTH, {-3, -8} };
|
149
|
+
robot_grid_status_t actual = robot_init_with_position(HEADING_EAST, 2, -7);
|
142
150
|
|
143
151
|
robot_simulator(&actual, "RRAAAAALA");
|
144
152
|
confirm_position(&expected, &actual);
|
@@ -147,8 +155,8 @@ void test_simulate_move_west_and_south(void)
|
|
147
155
|
void test_simulate_move_east_and_north(void)
|
148
156
|
{
|
149
157
|
TEST_IGNORE();
|
150
|
-
robot_grid_status_t expected = {
|
151
|
-
robot_grid_status_t actual = robot_init_with_position(
|
158
|
+
robot_grid_status_t expected = { HEADING_NORTH, {11, 5} };
|
159
|
+
robot_grid_status_t actual = robot_init_with_position(HEADING_SOUTH, 8, 4);
|
152
160
|
|
153
161
|
robot_simulator(&actual, "LAAARRRALLLL");
|
154
162
|
confirm_position(&expected, &actual);
|
@@ -2,6 +2,14 @@
|
|
2
2
|
#include "vendor/unity.h"
|
3
3
|
#include "../src/series.h"
|
4
4
|
|
5
|
+
void setUp(void)
|
6
|
+
{
|
7
|
+
}
|
8
|
+
|
9
|
+
void tearDown(void)
|
10
|
+
{
|
11
|
+
}
|
12
|
+
|
5
13
|
// helper routines to validate test results
|
6
14
|
static void test_solution(series_results_t * expected_solution,
|
7
15
|
series_results_t * actual_solution)
|
@@ -2,14 +2,14 @@
|
|
2
2
|
#define SPACE_AGE_H
|
3
3
|
|
4
4
|
typedef enum planet {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
MERCURY,
|
6
|
+
VENUS,
|
7
|
+
EARTH,
|
8
|
+
MARS,
|
9
|
+
JUPITER,
|
10
|
+
SATURN,
|
11
|
+
URANUS,
|
12
|
+
NEPTUNE,
|
13
13
|
} planet_t;
|
14
14
|
|
15
15
|
float convert_planet_age(planet_t planet, const long input);
|
@@ -1,51 +1,59 @@
|
|
1
1
|
#include "vendor/unity.h"
|
2
2
|
#include "../src/space_age.h"
|
3
3
|
|
4
|
+
void setUp(void)
|
5
|
+
{
|
6
|
+
}
|
7
|
+
|
8
|
+
void tearDown(void)
|
9
|
+
{
|
10
|
+
}
|
11
|
+
|
4
12
|
void test_convert_earth_year(void)
|
5
13
|
{
|
6
|
-
TEST_ASSERT_FLOAT_WITHIN(1, 31.69, convert_planet_age(
|
14
|
+
TEST_ASSERT_FLOAT_WITHIN(1, 31.69, convert_planet_age(EARTH, 1000000000));
|
7
15
|
}
|
8
16
|
|
9
17
|
void test_convert_mercury_year(void)
|
10
18
|
{
|
11
19
|
TEST_IGNORE(); // delete this line to run test
|
12
|
-
TEST_ASSERT_FLOAT_WITHIN(3, 280.88, convert_planet_age(
|
20
|
+
TEST_ASSERT_FLOAT_WITHIN(3, 280.88, convert_planet_age(MERCURY, 2134835688));
|
13
21
|
}
|
14
22
|
|
15
23
|
void test_convert_venus_year(void)
|
16
24
|
{
|
17
25
|
TEST_IGNORE();
|
18
|
-
TEST_ASSERT_FLOAT_WITHIN(1, 9.78, convert_planet_age(
|
26
|
+
TEST_ASSERT_FLOAT_WITHIN(1, 9.78, convert_planet_age(VENUS, 189839836));
|
19
27
|
}
|
20
28
|
|
21
29
|
void test_convert_mars_year(void)
|
22
30
|
{
|
23
31
|
TEST_IGNORE();
|
24
|
-
TEST_ASSERT_FLOAT_WITHIN(1, 39.25, convert_planet_age(
|
32
|
+
TEST_ASSERT_FLOAT_WITHIN(1, 39.25, convert_planet_age(MARS, 2329871239));
|
25
33
|
}
|
26
34
|
|
27
35
|
void test_convert_jupiter_year(void)
|
28
36
|
{
|
29
37
|
TEST_IGNORE();
|
30
|
-
TEST_ASSERT_FLOAT_WITHIN(0.1, 2.41, convert_planet_age(
|
38
|
+
TEST_ASSERT_FLOAT_WITHIN(0.1, 2.41, convert_planet_age(JUPITER, 901876382));
|
31
39
|
}
|
32
40
|
|
33
41
|
void test_convert_saturn_year(void)
|
34
42
|
{
|
35
43
|
TEST_IGNORE();
|
36
|
-
TEST_ASSERT_FLOAT_WITHIN(0.1, 3.23, convert_planet_age(
|
44
|
+
TEST_ASSERT_FLOAT_WITHIN(0.1, 3.23, convert_planet_age(SATURN, 3000000000));
|
37
45
|
}
|
38
46
|
|
39
47
|
void test_convert_uranus_year(void)
|
40
48
|
{
|
41
49
|
TEST_IGNORE();
|
42
|
-
TEST_ASSERT_FLOAT_WITHIN(0.1, 1.21, convert_planet_age(
|
50
|
+
TEST_ASSERT_FLOAT_WITHIN(0.1, 1.21, convert_planet_age(URANUS, 3210123456));
|
43
51
|
}
|
44
52
|
|
45
53
|
void test_convert_neptune_year(void)
|
46
54
|
{
|
47
55
|
TEST_IGNORE();
|
48
|
-
TEST_ASSERT_FLOAT_WITHIN(0.1, 1.58, convert_planet_age(
|
56
|
+
TEST_ASSERT_FLOAT_WITHIN(0.1, 1.58, convert_planet_age(NEPTUNE, 8210123456));
|
49
57
|
}
|
50
58
|
|
51
59
|
int main(void)
|
@@ -6,6 +6,14 @@
|
|
6
6
|
|
7
7
|
word_count_word_t actual_solution[MAX_WORDS];
|
8
8
|
|
9
|
+
void setUp(void)
|
10
|
+
{
|
11
|
+
}
|
12
|
+
|
13
|
+
void tearDown(void)
|
14
|
+
{
|
15
|
+
}
|
16
|
+
|
9
17
|
static void test_solution(word_count_word_t * expected_solution,
|
10
18
|
int expected_word_count,
|
11
19
|
word_count_word_t * actual_solution,
|
data/tracks/cfml/config.json
CHANGED
File without changes
|
@@ -0,0 +1,79 @@
|
|
1
|
+
component extends="testbox.system.BaseSpec" {
|
2
|
+
|
3
|
+
function beforeAll(){
|
4
|
+
SUT = createObject( 'Anagram' );
|
5
|
+
}
|
6
|
+
|
7
|
+
function run(){
|
8
|
+
|
9
|
+
describe( "My Anagram class", function(){
|
10
|
+
|
11
|
+
it( 'no matches', function(){
|
12
|
+
expect( SUT.anagrams( subject='diaper', candidates=["hello", "world", "zombies", "pants"] ) ).toBe( [] );
|
13
|
+
});
|
14
|
+
|
15
|
+
it( 'detects simple anagram', function(){
|
16
|
+
expect( SUT.anagrams( subject='ant', candidates=["tan", "stand", "at"] ) ).toBe( ["tan"] );
|
17
|
+
});
|
18
|
+
|
19
|
+
it( 'does not detect false positives', function(){
|
20
|
+
expect( SUT.anagrams( subject='galea', candidates=["eagle"] ) ).toBe( [] );
|
21
|
+
});
|
22
|
+
|
23
|
+
it( 'detects two anagrams', function(){
|
24
|
+
expect( SUT.anagrams( subject='master', candidates=["stream", "pigeon", "maters"] ) ).toBe( ["stream","maters"] );
|
25
|
+
});
|
26
|
+
|
27
|
+
it( 'does not detect anagram subsets', function(){
|
28
|
+
expect( SUT.anagrams( subject='good', candidates=["dog", "goody"] ) ).toBe( [] );
|
29
|
+
});
|
30
|
+
|
31
|
+
it( 'detects anagram', function(){
|
32
|
+
expect( SUT.anagrams( subject='listen', candidates=["enlists", "google", "inlets", "banana"] ) ).toBe( ["inlets"] );
|
33
|
+
});
|
34
|
+
|
35
|
+
it( 'detects three anagrams', function(){
|
36
|
+
expect( SUT.anagrams( subject='allergy', candidates=["gallery", "ballerina", "regally", "clergy", "largely", "leading"] ) ).toBe( ["gallery","regally","largely"] );
|
37
|
+
});
|
38
|
+
|
39
|
+
it( 'does not detect identical words', function(){
|
40
|
+
expect( SUT.anagrams( subject='corn', candidates=["corn", "dark", "Corn", "rank", "CORN", "cron", "park"] ) ).toBe( ["cron"] );
|
41
|
+
});
|
42
|
+
|
43
|
+
it( 'does not detect non-anagrams with identical checksum', function(){
|
44
|
+
expect( SUT.anagrams( subject='mass', candidates=["last"] ) ).toBe( [] );
|
45
|
+
});
|
46
|
+
|
47
|
+
it( 'detects anagrams case-insensitively', function(){
|
48
|
+
expect( SUT.anagrams( subject='Orchestra', candidates=["cashregister", "Carthorse", "radishes"] ) ).toBe( ["Carthorse"] );
|
49
|
+
});
|
50
|
+
|
51
|
+
it( 'detects anagrams using case-insensitive subject', function(){
|
52
|
+
expect( SUT.anagrams( subject='Orchestra', candidates=["cashregister", "carthorse", "radishes"] ) ).toBe( ["carthorse"] );
|
53
|
+
});
|
54
|
+
|
55
|
+
it( 'detects anagrams using case-insensitive possible matches', function(){
|
56
|
+
expect( SUT.anagrams( subject='orchestra', candidates=["cashregister", "Carthorse", "radishes"] ) ).toBe( ["Carthorse"] );
|
57
|
+
});
|
58
|
+
|
59
|
+
it( 'does not detect a word as its own anagram', function(){
|
60
|
+
expect( SUT.anagrams( subject='banana', candidates=["Banana"] ) ).toBe( [] );
|
61
|
+
});
|
62
|
+
|
63
|
+
it( 'does not detect a anagram if the original word is repeated', function(){
|
64
|
+
expect( SUT.anagrams( subject='go', candidates=["go Go GO"] ) ).toBe( [] );
|
65
|
+
});
|
66
|
+
|
67
|
+
it( 'anagrams must use all letters exactly once', function(){
|
68
|
+
expect( SUT.anagrams( subject='tapper', candidates=["patter"] ) ).toBe( [] );
|
69
|
+
});
|
70
|
+
|
71
|
+
it( 'capital word is not own anagram', function(){
|
72
|
+
expect( SUT.anagrams( subject='BANANA', candidates=["Banana"] ) ).toBe( [] );
|
73
|
+
});
|
74
|
+
|
75
|
+
});
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
}
|