trackler 2.0.8.31 → 2.0.8.32

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec9e8cd131aab975f2949305731a5eceef951290
4
- data.tar.gz: f2825b0807a002fb5f28b2f0a42dc4159ed59353
3
+ metadata.gz: cc6eaccb2054506665379c75e4e6eac1a1b18f8e
4
+ data.tar.gz: b4c0e4d2306d08b14bb309970c0ec5f608d520a5
5
5
  SHA512:
6
- metadata.gz: b14e3d7c62d9f65bd83e693a9d866c473d386a1e06a118d54ea1a840eebeabe0c26c570046afcb91836c07fcd7dfecf7c63a247f6fa6f6b7e81d058d03c257e2
7
- data.tar.gz: 572d3829ff054e6e3526f16b338c2fba8782fd73effcdcf302ccb5d0ceaed948162bd2699300fc740db5a2d5b5731fb8a6594285b2b461e8b3d90f999b63604f
6
+ metadata.gz: 23a92f21a2611df2a1228a1f3383253469cc8d612e815cf858acd562b2550920094372b03a828ce41ba902d7025bf777b240ef166c95a30e7bcafaae6d818c22
7
+ data.tar.gz: 2b5276e0fc50034f1ac28587454c3839f44e1ae54ee97c60fb38d9e281f0222ae073b779f3b6fc521a90e2c4a83e8b3086e6cd4ef8ef03d35909446d67da20ae
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.8.31"
2
+ VERSION = "2.0.8.32"
3
3
  end
@@ -3,7 +3,7 @@ language: bash
3
3
 
4
4
  before_install:
5
5
  - sudo apt-get -qq update
6
- - sudo apt-get install -y indent
6
+ - sudo apt-get install -y indent valgrind
7
7
 
8
8
  script:
9
9
  - bin/fetch-configlet
@@ -30,6 +30,7 @@ for D in exercises/*; do
30
30
  elif [ ${PIPESTATUS[0]} -ne 0 ]; then
31
31
  exit 1
32
32
  fi
33
+ valgrind --quiet --leak-check=full --error-exitcode=1 ./tests.out >> /dev/null;
33
34
  cd ${CURRENT_DIR};
34
35
  }
35
36
  fi
@@ -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
- char *temp = calloc(VALID_NUMBER_LENGTH, sizeof(char));
21
- strcpy(temp, &phone_number[1]);
22
- strcpy(phone_number, temp);
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 + 1, sizeof(char));
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
- strncat(output, &input[i], 1);
32
+ if (j > VALID_NUMBER_LENGTH) {
33
+ break;
34
+ }
35
+ output[j++] = input[i];
33
36
  }
34
37
  }
35
38
 
36
- if ((strlen(output) > 11) || (strlen(output) < 10)) {
39
+ if (j > 11 || j < 10) {
37
40
  strcpy(output, INVALID_NUMBER_RESULT);
38
- } else if (strlen(output) == 11) {
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]);
@@ -5,7 +5,7 @@
5
5
  char *to_rna(const char *dna)
6
6
  {
7
7
  size_t len = strlen(dna);
8
- char *rna = malloc(sizeof(char) * len);
8
+ char *rna = calloc(sizeof(char), len + 1);
9
9
 
10
10
  for (size_t i = 0; i < len; i++) {
11
11
  switch (dna[i]) {
@@ -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(0, sizeof(char) * MAX_NUMERAL_LENGTH);
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) {
@@ -45,6 +45,7 @@ unsigned int sieve(const unsigned int limit, primesArray_t primes)
45
45
  primes[numberOfPrimes++] = i;
46
46
  }
47
47
  }
48
+ free(numberIsPrime);
48
49
  }
49
50
  return numberOfPrimes;
50
51
  }
@@ -1,7 +1,7 @@
1
- [![Travis Build Status](https://api.travis-ci.org/exercism/xcpp.png?branch=master)](https://travis-ci.org/exercism/xcpp)
2
-
3
1
  # xC++
4
2
 
3
+ [![Travis Build Status](https://api.travis-ci.org/exercism/xcpp.svg?branch=master)](https://travis-ci.org/exercism/xcpp)
4
+
5
5
  Exercism Exercises in C++
6
6
 
7
7
  ## Contributing Guide
@@ -14,6 +14,13 @@
14
14
  "point-mutations"
15
15
  ],
16
16
  "exercises": [
17
+ {
18
+ "difficulty": 1,
19
+ "slug": "hello-world",
20
+ "topics": [
21
+ "strings"
22
+ ]
23
+ },
17
24
  {
18
25
  "difficulty": 1,
19
26
  "slug": "bob",
@@ -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})
@@ -0,0 +1,13 @@
1
+ #include "hello_world.h"
2
+
3
+ using namespace std;
4
+
5
+ namespace hello_world
6
+ {
7
+
8
+ string hello()
9
+ {
10
+ return "Hello, World!";
11
+ }
12
+
13
+ }
@@ -0,0 +1,12 @@
1
+ #if !defined(HELLO_WORLD_H)
2
+ #define HELLO_WORLD_H
3
+
4
+ #include <string>
5
+
6
+ namespace hello_world {
7
+
8
+ std::string hello();
9
+
10
+ }
11
+
12
+ #endif
@@ -0,0 +1,8 @@
1
+ #include "hello_world.h"
2
+ #define BOOST_TEST_MAIN
3
+ #include <boost/test/unit_test.hpp>
4
+
5
+ BOOST_AUTO_TEST_CASE(test_hello)
6
+ {
7
+ BOOST_REQUIRE_EQUAL("Hello, World!", hello_world::hello());
8
+ }
@@ -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
- [Theory]
6
- [InlineData("1", false)] // single digit strings can not be valid
7
- [InlineData("0", false)] // a single zero is invalid
8
- [InlineData("046 454 286", true)] // valid Canadian SIN
9
- [InlineData("046 454 287", false)] // invalid Canadian SIN
10
- [InlineData("8273 1232 7352 0569", false)] // invalid credit card
11
- [InlineData("827a 1232 7352 0569", false)] // strings that contain non-digits are not valid
12
- public void ValidateChecksum(string number, bool expected)
13
- {
14
- Assert.Equal(expected, Luhn.IsValid(number));
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
+ }
@@ -0,0 +1,9 @@
1
+ namespace Generators.Exercises
2
+ {
3
+ public class LuhnExercise : BooleanExercise
4
+ {
5
+ public LuhnExercise() : base("luhn")
6
+ {
7
+ }
8
+ }
9
+ }
@@ -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 right amount of coins.
6
- Otherwise returns the tuple {:ok, map_of_coins}
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(3, [5, 10, 15])
11
- :error
10
+ iex> Change.generate([5, 10, 15], 3)
11
+ {:error, "cannot change"}
12
12
 
13
- iex> Change.generate(18, [1, 5, 10])
14
- {:ok, %{1 => 3, 5 => 1, 10 => 1}}
13
+ iex> Change.generate([1, 5, 10], 18)
14
+ {:ok, [1, 1, 1, 5, 10]}
15
15
 
16
16
  """
17
17
 
18
- @spec generate(integer, list) :: {:ok, map} | :error
19
- def generate(amount, values) do
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
- test "returns :error on empty list" do
12
- assert Change.generate(1, []) == :error
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 "generates the correct change when only one coin type is needed" do
17
- change = %{1 => 5, 10 => 0}
18
- assert Change.generate(5, [1, 10]) == {:ok, change}
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 "generates the correct change when multiple coin types are needed" do
23
- change = %{1 => 3, 5 => 1, 10 => 1}
24
- assert Change.generate(18, [1, 5, 10]) == {:ok, change}
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 "returns :error when it is not possible to generate change" do
29
- assert Change.generate(3, [5, 10, 25]) == :error
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 "generates change using only small coins when it is not possible to combine them with larger coins" do
34
- change = %{3 => 34, 100 => 0}
35
- assert Change.generate(102, [3, 100]) == {:ok, change}
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 "generates the same change given any coin order" do
40
- change = %{1 => 3, 5 => 1, 10 => 1}
41
- assert Change.generate(18, [1, 5, 10]) == {:ok, change}
42
- assert Change.generate(18, [10, 5, 1]) == {:ok, change}
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 "generates the correct change for large values with many coins" do
47
- change = %{1 => 3, 5 => 1, 10 => 0, 25 => 1, 100 => 1}
48
- assert Change.generate(133, [1, 5, 10, 25, 100]) == {:ok, change}
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 right amount of coins.
6
- Otherwise returns the tuple {:ok, map_of_coins}
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(3, [5, 10, 15])
11
- :error
10
+ iex> Change.generate([5, 10, 15], 3)
11
+ {:error, "cannot change"}
12
12
 
13
- iex> Change.generate(18, [1, 5, 10])
14
- {:ok, %{1 => 3, 5 => 1, 10 => 1}}
13
+ iex> Change.generate([1, 5, 10], 18)
14
+ {:ok, [1, 1, 1, 5, 10]}
15
15
 
16
16
  """
17
17
 
18
- @spec generate(integer, list) :: {:ok, map} | :error
19
- def generate(amount, values) do
20
- values |> Enum.sort(&(&2 < &1)) |> generate(amount, %{})
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(_, 0, acc), do: {:ok, acc}
24
- defp generate([], _, _), do: :error
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
- defp divisible?(num, values) do
34
- Enum.any?(values, &(rem(num, &1) == 0))
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 ])\1*/, string)
5
+ Regex.scan(~r/([a-zA-Z\s])\1*/, string)
6
6
  |> Enum.map_join(fn([run, c]) ->
7
- if String.match?(run, ~r/\s+/) do
8
- run
9
- else
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 "encode simple" do
32
- assert RunLengthEncoder.encode("AABBBCCCC") == "2A3B4C"
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 simple" do
37
- assert RunLengthEncoder.decode("2A3B4C") == "AABBBCCCC"
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 "encode with single values" do
42
- assert RunLengthEncoder.encode("WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB") === "12WB12W3B24WB"
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 with single values" do
47
- assert RunLengthEncoder.decode("12WB12W3B24WB") === "WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB"
66
+ test "decode lower case string" do
67
+ assert RunLengthEncoder.decode("2a3b4c") === "aabbbcccc"
48
68
  end
49
69
 
50
70
  @tag :pending
51
- test "decode(encode(...)) combination" do
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
@@ -20,27 +20,27 @@
20
20
  "topics": []
21
21
  },
22
22
  {
23
- "difficulty": 1,
23
+ "difficulty": 2,
24
24
  "slug": "hamming",
25
25
  "topics": []
26
26
  },
27
27
  {
28
- "difficulty": 1,
28
+ "difficulty": 4,
29
29
  "slug": "gigasecond",
30
30
  "topics": []
31
31
  },
32
32
  {
33
- "difficulty": 1,
33
+ "difficulty": 3,
34
34
  "slug": "raindrops",
35
35
  "topics": []
36
36
  },
37
37
  {
38
- "difficulty": 1,
38
+ "difficulty": 2,
39
39
  "slug": "rna-transcription",
40
40
  "topics": []
41
41
  },
42
42
  {
43
- "difficulty": 1,
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": 1,
53
+ "difficulty": 4,
54
54
  "slug": "nth-prime",
55
55
  "topics": []
56
56
  },
57
57
  {
58
- "difficulty": 1,
58
+ "difficulty": 3,
59
59
  "slug": "robot-name",
60
60
  "topics": []
61
61
  },
62
62
  {
63
- "difficulty": 1,
63
+ "difficulty": 4,
64
64
  "slug": "roman-numerals",
65
65
  "topics": []
66
66
  },
67
67
  {
68
- "difficulty": 1,
68
+ "difficulty": 2,
69
69
  "slug": "grains",
70
70
  "topics": []
71
71
  },
72
72
  {
73
- "difficulty": 1,
73
+ "difficulty": 3,
74
74
  "slug": "word-count",
75
75
  "topics": []
76
76
  },
77
77
  {
78
- "difficulty": 1,
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.31
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-25 00:00:00.000000000 Z
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