trackler 2.0.8.31 → 2.0.8.32
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/tracks/c/.travis.yml +1 -1
- data/tracks/c/bin/run-tests +1 -0
- data/tracks/c/exercises/atbash-cipher/src/example.c +1 -1
- data/tracks/c/exercises/phone-number/src/example.c +12 -9
- data/tracks/c/exercises/rna-transcription/src/example.c +1 -1
- data/tracks/c/exercises/roman-numerals/src/example.c +1 -1
- data/tracks/c/exercises/sieve/src/example.c +1 -0
- data/tracks/cpp/README.md +2 -2
- data/tracks/cpp/config.json +7 -0
- data/tracks/cpp/exercises/hello-world/CMakeLists.txt +59 -0
- data/tracks/cpp/exercises/hello-world/example.cpp +13 -0
- data/tracks/cpp/exercises/hello-world/hello_world.h +12 -0
- data/tracks/cpp/exercises/hello-world/hello_world_test.cpp +8 -0
- data/tracks/csharp/exercises/clock/ClockTest.cs +7 -0
- data/tracks/csharp/exercises/luhn/LuhnTest.cs +81 -12
- data/tracks/csharp/generators/Exercises/LuhnExercise.cs +9 -0
- data/tracks/elixir/exercises/change/change.exs +8 -8
- data/tracks/elixir/exercises/change/change_test.exs +47 -20
- data/tracks/elixir/exercises/change/example.exs +23 -20
- data/tracks/elixir/exercises/run-length-encoding/example.exs +4 -8
- data/tracks/elixir/exercises/run-length-encoding/rle_test.exs +30 -10
- data/tracks/groovy/config.json +11 -11
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc6eaccb2054506665379c75e4e6eac1a1b18f8e
|
4
|
+
data.tar.gz: b4c0e4d2306d08b14bb309970c0ec5f608d520a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23a92f21a2611df2a1228a1f3383253469cc8d612e815cf858acd562b2550920094372b03a828ce41ba902d7025bf777b240ef166c95a30e7bcafaae6d818c22
|
7
|
+
data.tar.gz: 2b5276e0fc50034f1ac28587454c3839f44e1ae54ee97c60fb38d9e281f0222ae073b779f3b6fc521a90e2c4a83e8b3086e6cd4ef8ef03d35909446d67da20ae
|
data/lib/trackler/version.rb
CHANGED
data/tracks/c/.travis.yml
CHANGED
data/tracks/c/bin/run-tests
CHANGED
@@ -30,7 +30,7 @@ static char get_decoded_character(char character)
|
|
30
30
|
|
31
31
|
char *atbash_encode(const char *input)
|
32
32
|
{
|
33
|
-
char *output = malloc(strlen(input) + (strlen(input) / GROUP_SIZE));
|
33
|
+
char *output = malloc(strlen(input) + (strlen(input) / GROUP_SIZE) + 1);
|
34
34
|
int group_count = 0;
|
35
35
|
|
36
36
|
output[0] = '\0';
|
@@ -17,25 +17,28 @@
|
|
17
17
|
|
18
18
|
static void remove_leading_digit(char *phone_number)
|
19
19
|
{
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
free(temp);
|
20
|
+
for (size_t i = 0; phone_number[i]; ++i) {
|
21
|
+
phone_number[i] = phone_number[i + 1];
|
22
|
+
}
|
24
23
|
}
|
25
24
|
|
26
25
|
char *phone_number_clean(const char *input)
|
27
26
|
{
|
28
|
-
char *output = calloc(VALID_NUMBER_LENGTH +
|
27
|
+
char *output = calloc(VALID_NUMBER_LENGTH + 2, sizeof(char));
|
29
28
|
|
29
|
+
size_t j = 0;
|
30
30
|
for (size_t i = 0; i < strlen(input); i++) {
|
31
31
|
if (isdigit(input[i])) {
|
32
|
-
|
32
|
+
if (j > VALID_NUMBER_LENGTH) {
|
33
|
+
break;
|
34
|
+
}
|
35
|
+
output[j++] = input[i];
|
33
36
|
}
|
34
37
|
}
|
35
38
|
|
36
|
-
if (
|
39
|
+
if (j > 11 || j < 10) {
|
37
40
|
strcpy(output, INVALID_NUMBER_RESULT);
|
38
|
-
} else if (
|
41
|
+
} else if (j == 11) {
|
39
42
|
if (output[0] == '1') {
|
40
43
|
remove_leading_digit(output);
|
41
44
|
} else {
|
@@ -57,7 +60,7 @@ char *phone_number_get_area_code(const char *input)
|
|
57
60
|
char *phone_number_format(const char *input)
|
58
61
|
{
|
59
62
|
char *cleaned_input = phone_number_clean(input);
|
60
|
-
char *output = calloc(FORMATTED_LENGTH, sizeof(char));
|
63
|
+
char *output = calloc(FORMATTED_LENGTH + 1, sizeof(char));
|
61
64
|
|
62
65
|
sprintf(output, "(%.3s) %.3s-%.4s", cleaned_input,
|
63
66
|
&cleaned_input[AREA_CODE_LENGTH], &cleaned_input[EXTENSION_OFFSET]);
|
@@ -28,7 +28,7 @@ const numeral_values_t numeral_values[] = {
|
|
28
28
|
|
29
29
|
char *to_roman_numeral(unsigned int number)
|
30
30
|
{
|
31
|
-
char *numerals = calloc(
|
31
|
+
char *numerals = calloc(sizeof(char), MAX_NUMERAL_LENGTH);
|
32
32
|
|
33
33
|
for (size_t i = 0; i < NUM_OF_ELEMENTS(numeral_values); i++) {
|
34
34
|
while (number >= numeral_values[i].value) {
|
data/tracks/cpp/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
[](https://travis-ci.org/exercism/xcpp)
|
2
|
-
|
3
1
|
# xC++
|
4
2
|
|
3
|
+
[](https://travis-ci.org/exercism/xcpp)
|
4
|
+
|
5
5
|
Exercism Exercises in C++
|
6
6
|
|
7
7
|
## Contributing Guide
|
data/tracks/cpp/config.json
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Get the exercise name from the current directory
|
2
|
+
get_filename_component(exercise ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
3
|
+
|
4
|
+
# Basic CMake project
|
5
|
+
cmake_minimum_required(VERSION 2.8.11)
|
6
|
+
|
7
|
+
# Name the project after the exercise
|
8
|
+
project(${exercise} CXX)
|
9
|
+
|
10
|
+
# Locate Boost libraries: unit_test_framework, date_time and regex
|
11
|
+
set(Boost_USE_STATIC_LIBS ON)
|
12
|
+
set(Boost_USE_MULTITHREADED ON)
|
13
|
+
set(Boost_USE_STATIC_RUNTIME OFF)
|
14
|
+
find_package(Boost 1.55 REQUIRED COMPONENTS unit_test_framework date_time regex)
|
15
|
+
|
16
|
+
# Enable C++11 features on gcc/clang
|
17
|
+
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "(GNU|Clang)")
|
18
|
+
set(CMAKE_CXX_FLAGS "-std=c++11")
|
19
|
+
endif()
|
20
|
+
|
21
|
+
# Configure to run all the tests?
|
22
|
+
if(${EXERCISM_RUN_ALL_TESTS})
|
23
|
+
add_definitions(-DEXERCISM_RUN_ALL_TESTS)
|
24
|
+
endif()
|
25
|
+
|
26
|
+
# Get a source filename from the exercise name by replacing -'s with _'s
|
27
|
+
string(REPLACE "-" "_" file ${exercise})
|
28
|
+
|
29
|
+
# Implementation could be only a header
|
30
|
+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.cpp)
|
31
|
+
set(exercise_cpp ${file}.cpp)
|
32
|
+
else()
|
33
|
+
set(exercise_cpp "")
|
34
|
+
endif()
|
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
|
+
# Build executable from sources and headers
|
44
|
+
add_executable(${exercise} ${file}_test.cpp ${test_helper} ${exercise_cpp} ${file}.h)
|
45
|
+
|
46
|
+
# We need boost includes
|
47
|
+
target_include_directories(${exercise} PRIVATE ${Boost_INCLUDE_DIRS})
|
48
|
+
|
49
|
+
# We need boost libraries
|
50
|
+
target_link_libraries(${exercise} ${Boost_LIBRARIES})
|
51
|
+
|
52
|
+
# Tell MSVC not to warn us about unchecked iterators in debug builds
|
53
|
+
if(${MSVC})
|
54
|
+
set_target_properties(${exercise} PROPERTIES
|
55
|
+
COMPILE_DEFINITIONS_DEBUG _SCL_SECURE_NO_WARNINGS)
|
56
|
+
endif()
|
57
|
+
|
58
|
+
# Run the tests on every build
|
59
|
+
add_custom_command(TARGET ${exercise} POST_BUILD COMMAND ${exercise})
|
@@ -111,4 +111,11 @@ public void Overflown_clocks_with_same_time_are_equal()
|
|
111
111
|
var clock2 = new Clock(38, 30);
|
112
112
|
Assert.Equal(clock2, clock1);
|
113
113
|
}
|
114
|
+
|
115
|
+
[Fact(Skip = "Remove to run test")]
|
116
|
+
public void Can_wrap_around_more_than_one_day()
|
117
|
+
{
|
118
|
+
var clock = new Clock(10).Subtract(7224);
|
119
|
+
Assert.Equal("09:36", clock.ToString());
|
120
|
+
}
|
114
121
|
}
|
@@ -2,15 +2,84 @@
|
|
2
2
|
|
3
3
|
public class LuhnTest
|
4
4
|
{
|
5
|
-
[
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
[
|
12
|
-
public void
|
13
|
-
{
|
14
|
-
Assert.
|
15
|
-
}
|
16
|
-
|
5
|
+
[Fact]
|
6
|
+
public void Single_digit_strings_can_not_be_valid()
|
7
|
+
{
|
8
|
+
Assert.False(Luhn.IsValid("1"));
|
9
|
+
}
|
10
|
+
|
11
|
+
[Fact(Skip = "Remove to run test")]
|
12
|
+
public void A_single_zero_is_invalid()
|
13
|
+
{
|
14
|
+
Assert.False(Luhn.IsValid("0"));
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
[Fact(Skip = "Remove to run test")]
|
19
|
+
public void A_simple_valid_SIN_that_remains_valid_if_reversed()
|
20
|
+
{
|
21
|
+
Assert.True(Luhn.IsValid("059"));
|
22
|
+
}
|
23
|
+
|
24
|
+
[Fact(Skip = "Remove to run test")]
|
25
|
+
public void A_simple_valid_SIN_that_becomes_invalid_if_reversed()
|
26
|
+
{
|
27
|
+
Assert.True(Luhn.IsValid("59"));
|
28
|
+
}
|
29
|
+
|
30
|
+
[Fact(Skip = "Remove to run test")]
|
31
|
+
public void A_valid_Canadian_SIN()
|
32
|
+
{
|
33
|
+
Assert.True(Luhn.IsValid("055 444 285"));
|
34
|
+
}
|
35
|
+
|
36
|
+
[Fact(Skip = "Remove to run test")]
|
37
|
+
public void Invalid_Canadian_SIN()
|
38
|
+
{
|
39
|
+
Assert.False(Luhn.IsValid("055 444 286"));
|
40
|
+
}
|
41
|
+
|
42
|
+
|
43
|
+
[Fact(Skip = "Remove to run test")]
|
44
|
+
public void Invalid_credit_card()
|
45
|
+
{
|
46
|
+
Assert.False(Luhn.IsValid("8273 1232 7352 0569"));
|
47
|
+
}
|
48
|
+
|
49
|
+
[Fact(Skip = "Remove to run test")]
|
50
|
+
public void Valid_strings_with_a_non_digit_included_become_invalid()
|
51
|
+
{
|
52
|
+
Assert.False(Luhn.IsValid("055a 444 285"));
|
53
|
+
}
|
54
|
+
|
55
|
+
[Fact(Skip = "Remove to run test")]
|
56
|
+
public void Valid_strings_with_punctuation_included_become_invalid()
|
57
|
+
{
|
58
|
+
Assert.False(Luhn.IsValid("055-444-285"));
|
59
|
+
}
|
60
|
+
|
61
|
+
[Fact(Skip = "Remove to run test")]
|
62
|
+
public void Valid_strings_with_symbols_included_become_invalid()
|
63
|
+
{
|
64
|
+
Assert.False(Luhn.IsValid("055£ 444$ 285"));
|
65
|
+
}
|
66
|
+
|
67
|
+
[Fact(Skip = "Remove to run test")]
|
68
|
+
public void Single_zero_with_space_is_invalid()
|
69
|
+
{
|
70
|
+
Assert.False(Luhn.IsValid(" 0"));
|
71
|
+
}
|
72
|
+
|
73
|
+
[Fact(Skip = "Remove to run test")]
|
74
|
+
public void More_than_a_single_zero_is_valid()
|
75
|
+
{
|
76
|
+
Assert.True(Luhn.IsValid("0000 0"));
|
77
|
+
}
|
78
|
+
|
79
|
+
[Fact(Skip = "Remove to run test")]
|
80
|
+
public void Input_digit_9_is_correctly_converted_to_output_digit_9()
|
81
|
+
{
|
82
|
+
Assert.True(Luhn.IsValid("091"));
|
83
|
+
}
|
84
|
+
|
85
|
+
}
|
@@ -2,21 +2,21 @@ defmodule Change do
|
|
2
2
|
@doc """
|
3
3
|
Determine the least number of coins to be given to the user such
|
4
4
|
that the sum of the coins' value would equal the correct amount of change.
|
5
|
-
It returns :error if it is not possible to compute the
|
6
|
-
Otherwise returns the tuple {:ok,
|
5
|
+
It returns {:error, "cannot change"} if it is not possible to compute the
|
6
|
+
right amount of coins. Otherwise returns the tuple {:ok, list_of_coins}
|
7
7
|
|
8
8
|
## Examples
|
9
9
|
|
10
|
-
iex> Change.generate(
|
11
|
-
:error
|
10
|
+
iex> Change.generate([5, 10, 15], 3)
|
11
|
+
{:error, "cannot change"}
|
12
12
|
|
13
|
-
iex> Change.generate(
|
14
|
-
{:ok,
|
13
|
+
iex> Change.generate([1, 5, 10], 18)
|
14
|
+
{:ok, [1, 1, 1, 5, 10]}
|
15
15
|
|
16
16
|
"""
|
17
17
|
|
18
|
-
@spec generate(
|
19
|
-
def generate(
|
18
|
+
@spec generate(list, integer) :: {:ok, list} | {:error, String.t}
|
19
|
+
def generate(coins, target) do
|
20
20
|
|
21
21
|
end
|
22
22
|
end
|
@@ -8,43 +8,70 @@ ExUnit.configure exclude: :pending, trace: true
|
|
8
8
|
defmodule ChangeTest do
|
9
9
|
use ExUnit.Case
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
# @tag :pending
|
12
|
+
test "no coins make 0 change" do
|
13
|
+
coins = [1, 5, 10, 21, 25]
|
14
|
+
expected = []
|
15
|
+
assert Change.generate(coins, 0) == {:ok, expected}
|
13
16
|
end
|
14
17
|
|
15
18
|
@tag :pending
|
16
|
-
test "
|
17
|
-
|
18
|
-
|
19
|
+
test "cannot find negative change values" do
|
20
|
+
coins = [1, 2, 5]
|
21
|
+
assert Change.generate(coins, -5) == {:error, "cannot change"}
|
19
22
|
end
|
20
23
|
|
21
24
|
@tag :pending
|
22
|
-
test "
|
23
|
-
|
24
|
-
|
25
|
+
test "error testing for change smaller than the smallest of coins" do
|
26
|
+
coins = [5, 10]
|
27
|
+
assert Change.generate(coins, 3) == {:error, "cannot change"}
|
25
28
|
end
|
26
29
|
|
27
30
|
@tag :pending
|
28
|
-
test "
|
29
|
-
|
31
|
+
test "single coin change" do
|
32
|
+
coins = [1, 5, 10, 25, 100]
|
33
|
+
expected = [25]
|
34
|
+
assert Change.generate(coins, 25) == {:ok, expected}
|
30
35
|
end
|
31
36
|
|
32
37
|
@tag :pending
|
33
|
-
test "
|
34
|
-
|
35
|
-
|
38
|
+
test "multiple coin change" do
|
39
|
+
coins = [1, 5, 10, 25, 100]
|
40
|
+
expected = [5, 10]
|
41
|
+
assert Change.generate(coins, 15) == {:ok, expected}
|
42
|
+
end
|
43
|
+
|
44
|
+
@tag :pending
|
45
|
+
test "possible change without unit coins available" do
|
46
|
+
coins = [2, 5, 10, 20, 50]
|
47
|
+
expected = [2, 2, 2, 5, 10]
|
48
|
+
assert Change.generate(coins, 21) == {:ok, expected}
|
49
|
+
end
|
50
|
+
|
51
|
+
@tag :pending
|
52
|
+
test "change with Lilliputian Coins" do
|
53
|
+
coins = [1, 4, 15, 20, 50]
|
54
|
+
expected = [4, 4, 15]
|
55
|
+
assert Change.generate(coins, 23) == {:ok, expected}
|
56
|
+
end
|
57
|
+
|
58
|
+
@tag :pending
|
59
|
+
test "change with Lower Elbonia Coins" do
|
60
|
+
coins = [1, 5, 10, 21, 25]
|
61
|
+
expected = [21, 21, 21]
|
62
|
+
assert Change.generate(coins, 63) == {:ok, expected}
|
36
63
|
end
|
37
64
|
|
38
65
|
@tag :pending
|
39
|
-
test "
|
40
|
-
|
41
|
-
|
42
|
-
|
66
|
+
test "large target values" do
|
67
|
+
coins = [1, 2, 5, 10, 20, 50, 100]
|
68
|
+
expected = [2, 2, 5, 20, 20, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100]
|
69
|
+
assert Change.generate(coins, 999) == {:ok, expected}
|
43
70
|
end
|
44
71
|
|
45
72
|
@tag :pending
|
46
|
-
test "
|
47
|
-
|
48
|
-
|
73
|
+
test "error if no combination can add up to target" do
|
74
|
+
coins = [5, 10]
|
75
|
+
assert Change.generate(coins, 94) == {:error, "cannot change"}
|
49
76
|
end
|
50
77
|
end
|
@@ -2,35 +2,38 @@ defmodule Change do
|
|
2
2
|
@doc """
|
3
3
|
Determine the least number of coins to be given to the user such
|
4
4
|
that the sum of the coins' value would equal the correct amount of change.
|
5
|
-
It returns :error if it is not possible to compute the
|
6
|
-
Otherwise returns the tuple {:ok,
|
5
|
+
It returns {:error, "cannot change"} if it is not possible to compute the
|
6
|
+
right amount of coins. Otherwise returns the tuple {:ok, list_of_coins}
|
7
7
|
|
8
8
|
## Examples
|
9
9
|
|
10
|
-
iex> Change.generate(
|
11
|
-
:error
|
10
|
+
iex> Change.generate([5, 10, 15], 3)
|
11
|
+
{:error, "cannot change"}
|
12
12
|
|
13
|
-
iex> Change.generate(
|
14
|
-
{:ok,
|
13
|
+
iex> Change.generate([1, 5, 10], 18)
|
14
|
+
{:ok, [1, 1, 1, 5, 10]}
|
15
15
|
|
16
16
|
"""
|
17
17
|
|
18
|
-
@spec generate(
|
19
|
-
def generate(
|
20
|
-
|
18
|
+
@spec generate(list, integer) :: {:ok, list} | {:error, String.t}
|
19
|
+
def generate(coins, target) do
|
20
|
+
coins |> Enum.sort(&>/2) |> generate(target, [], {:error, "cannot change"})
|
21
21
|
end
|
22
22
|
|
23
|
-
defp generate(_,
|
24
|
-
|
25
|
-
defp generate(values = [h | t], amount, acc) do
|
26
|
-
if amount >= h && divisible?(amount - h, values) do
|
27
|
-
generate(values, amount - h, Map.update(acc, h, 1, &(&1 + 1)))
|
28
|
-
else
|
29
|
-
generate(t, amount, Map.put_new(acc, h, 0))
|
30
|
-
end
|
23
|
+
defp generate(_, _, current, {:ok, best}) when length(current) >= length(best) do
|
24
|
+
{:ok, best}
|
31
25
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
defp generate(_, 0, current, _) do
|
27
|
+
{:ok, current}
|
28
|
+
end
|
29
|
+
defp generate([], _, _, best) do
|
30
|
+
best
|
31
|
+
end
|
32
|
+
defp generate([coin | coins], target, current, best) when coin > target do
|
33
|
+
generate(coins, target, current, best)
|
34
|
+
end
|
35
|
+
defp generate([coin | coins], target, current, best) do
|
36
|
+
first_try = generate([coin | coins], target - coin, [coin | current], best)
|
37
|
+
generate(coins, target, current, first_try)
|
35
38
|
end
|
36
39
|
end
|
@@ -2,15 +2,11 @@ defmodule RunLengthEncoder do
|
|
2
2
|
|
3
3
|
@spec encode(String.t) :: String.t
|
4
4
|
def encode(string) do
|
5
|
-
Regex.scan(~r/([a-zA-Z
|
5
|
+
Regex.scan(~r/([a-zA-Z\s])\1*/, string)
|
6
6
|
|> Enum.map_join(fn([run, c]) ->
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
times = String.length(run)
|
11
|
-
number = if times == 1 do "" else times end
|
12
|
-
"#{number}#{c}"
|
13
|
-
end
|
7
|
+
times = String.length(run)
|
8
|
+
number = if times == 1 do "" else times end
|
9
|
+
"#{number}#{c}"
|
14
10
|
end)
|
15
11
|
end
|
16
12
|
|
@@ -13,10 +13,30 @@ defmodule RunLengthEncoderTest do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
@tag :pending
|
16
|
-
test "encode single characters only" do
|
16
|
+
test "encode single characters only are encoded without count" do
|
17
17
|
assert RunLengthEncoder.encode("XYZ") === "XYZ"
|
18
18
|
end
|
19
19
|
|
20
|
+
@tag :pending
|
21
|
+
test "encode string with no single characters" do
|
22
|
+
assert RunLengthEncoder.encode("AABBBCCCC") == "2A3B4C"
|
23
|
+
end
|
24
|
+
|
25
|
+
@tag :pending
|
26
|
+
test "encode single characters mixed with repeated characters" do
|
27
|
+
assert RunLengthEncoder.encode("WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB") === "12WB12W3B24WB"
|
28
|
+
end
|
29
|
+
|
30
|
+
@tag :pending
|
31
|
+
test "encode multiple whitespace mixed in string" do
|
32
|
+
assert RunLengthEncoder.encode(" hsqq qww ") === "2 hs2q q2w2 "
|
33
|
+
end
|
34
|
+
|
35
|
+
@tag :pending
|
36
|
+
test "encode lowercase characters" do
|
37
|
+
assert RunLengthEncoder.encode("aabbbcccc") === "2a3b4c"
|
38
|
+
end
|
39
|
+
|
20
40
|
@tag :pending
|
21
41
|
test "decode empty string" do
|
22
42
|
assert RunLengthEncoder.decode("") === ""
|
@@ -28,27 +48,27 @@ defmodule RunLengthEncoderTest do
|
|
28
48
|
end
|
29
49
|
|
30
50
|
@tag :pending
|
31
|
-
test "
|
32
|
-
assert RunLengthEncoder.
|
51
|
+
test "decode string with no single characters" do
|
52
|
+
assert RunLengthEncoder.decode("2A3B4C") == "AABBBCCCC"
|
33
53
|
end
|
34
54
|
|
35
55
|
@tag :pending
|
36
|
-
test "decode
|
37
|
-
assert RunLengthEncoder.decode("
|
56
|
+
test "decode single characters with repeated characters" do
|
57
|
+
assert RunLengthEncoder.decode("12WB12W3B24WB") === "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"
|
38
58
|
end
|
39
59
|
|
40
60
|
@tag :pending
|
41
|
-
test "
|
42
|
-
assert RunLengthEncoder.
|
61
|
+
test "decode multiple whitespace mixed in string" do
|
62
|
+
assert RunLengthEncoder.decode("2 hs2q q2w2 ") === " hsqq qww "
|
43
63
|
end
|
44
64
|
|
45
65
|
@tag :pending
|
46
|
-
test "decode
|
47
|
-
assert RunLengthEncoder.decode("
|
66
|
+
test "decode lower case string" do
|
67
|
+
assert RunLengthEncoder.decode("2a3b4c") === "aabbbcccc"
|
48
68
|
end
|
49
69
|
|
50
70
|
@tag :pending
|
51
|
-
test "
|
71
|
+
test "encode followed by decode gives original string" do
|
52
72
|
original = "zzz ZZ zZ"
|
53
73
|
encoded = RunLengthEncoder.encode(original)
|
54
74
|
assert RunLengthEncoder.decode(encoded) === original
|
data/tracks/groovy/config.json
CHANGED
@@ -20,27 +20,27 @@
|
|
20
20
|
"topics": []
|
21
21
|
},
|
22
22
|
{
|
23
|
-
"difficulty":
|
23
|
+
"difficulty": 2,
|
24
24
|
"slug": "hamming",
|
25
25
|
"topics": []
|
26
26
|
},
|
27
27
|
{
|
28
|
-
"difficulty":
|
28
|
+
"difficulty": 4,
|
29
29
|
"slug": "gigasecond",
|
30
30
|
"topics": []
|
31
31
|
},
|
32
32
|
{
|
33
|
-
"difficulty":
|
33
|
+
"difficulty": 3,
|
34
34
|
"slug": "raindrops",
|
35
35
|
"topics": []
|
36
36
|
},
|
37
37
|
{
|
38
|
-
"difficulty":
|
38
|
+
"difficulty": 2,
|
39
39
|
"slug": "rna-transcription",
|
40
40
|
"topics": []
|
41
41
|
},
|
42
42
|
{
|
43
|
-
"difficulty":
|
43
|
+
"difficulty": 2,
|
44
44
|
"slug": "difference-of-squares",
|
45
45
|
"topics": []
|
46
46
|
},
|
@@ -50,32 +50,32 @@
|
|
50
50
|
"topics": []
|
51
51
|
},
|
52
52
|
{
|
53
|
-
"difficulty":
|
53
|
+
"difficulty": 4,
|
54
54
|
"slug": "nth-prime",
|
55
55
|
"topics": []
|
56
56
|
},
|
57
57
|
{
|
58
|
-
"difficulty":
|
58
|
+
"difficulty": 3,
|
59
59
|
"slug": "robot-name",
|
60
60
|
"topics": []
|
61
61
|
},
|
62
62
|
{
|
63
|
-
"difficulty":
|
63
|
+
"difficulty": 4,
|
64
64
|
"slug": "roman-numerals",
|
65
65
|
"topics": []
|
66
66
|
},
|
67
67
|
{
|
68
|
-
"difficulty":
|
68
|
+
"difficulty": 2,
|
69
69
|
"slug": "grains",
|
70
70
|
"topics": []
|
71
71
|
},
|
72
72
|
{
|
73
|
-
"difficulty":
|
73
|
+
"difficulty": 3,
|
74
74
|
"slug": "word-count",
|
75
75
|
"topics": []
|
76
76
|
},
|
77
77
|
{
|
78
|
-
"difficulty":
|
78
|
+
"difficulty": 3,
|
79
79
|
"slug": "phone-number",
|
80
80
|
"topics": []
|
81
81
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trackler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.8.
|
4
|
+
version: 2.0.8.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katrina Owen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -1178,6 +1178,10 @@ files:
|
|
1178
1178
|
- tracks/cpp/exercises/hamming/example.cpp
|
1179
1179
|
- tracks/cpp/exercises/hamming/example.h
|
1180
1180
|
- tracks/cpp/exercises/hamming/hamming_test.cpp
|
1181
|
+
- tracks/cpp/exercises/hello-world/CMakeLists.txt
|
1182
|
+
- tracks/cpp/exercises/hello-world/example.cpp
|
1183
|
+
- tracks/cpp/exercises/hello-world/hello_world.h
|
1184
|
+
- tracks/cpp/exercises/hello-world/hello_world_test.cpp
|
1181
1185
|
- tracks/cpp/exercises/hexadecimal/CMakeLists.txt
|
1182
1186
|
- tracks/cpp/exercises/hexadecimal/example.cpp
|
1183
1187
|
- tracks/cpp/exercises/hexadecimal/example.h
|
@@ -1841,6 +1845,7 @@ files:
|
|
1841
1845
|
- tracks/csharp/generators/Exercises/Exercise.cs
|
1842
1846
|
- tracks/csharp/generators/Exercises/IsogramExercise.cs
|
1843
1847
|
- tracks/csharp/generators/Exercises/LeapExercise.cs
|
1848
|
+
- tracks/csharp/generators/Exercises/LuhnExercise.cs
|
1844
1849
|
- tracks/csharp/generators/Exercises/NthPrimeExercise.cs
|
1845
1850
|
- tracks/csharp/generators/Exercises/PerfectNumbersExercise.cs
|
1846
1851
|
- tracks/csharp/generators/Exercises/PigLatinExercise.cs
|