Skip to content

Commit

Permalink
Merge pull request #145 from petertseng/lsp
Browse files Browse the repository at this point in the history
largest-series-product: Do not test digits/slices
  • Loading branch information
rubysolo committed Mar 14, 2016
2 parents 507cc47 + 0267f85 commit 06977a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 64 deletions.
6 changes: 3 additions & 3 deletions exercises/largest-series-product/example.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ defmodule Series do
Splits up the given string of numbers into an array of integers.
"""
@spec digits(String.t) :: [non_neg_integer]
def digits("") do
defp digits("") do
[]
end

def digits(number_string) do
defp digits(number_string) do
String.split(number_string, "", trim: true)
|> Enum.reduce([], fn(char, acc) -> [String.to_integer(char)|acc] end)
|> Enum.reverse
Expand All @@ -18,7 +18,7 @@ defmodule Series do
Generates sublists of a given size from a given string of numbers.
"""
@spec slices(String.t, non_neg_integer) :: [list(non_neg_integer)]
def slices(number_string, size) do
defp slices(number_string, size) do
digits = digits(number_string)
chunk(digits, size, 1)
end
Expand Down
16 changes: 0 additions & 16 deletions exercises/largest-series-product/largest_series_product.exs
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
defmodule Series do

@doc """
Splits up the given string of numbers into an array of integers.
"""
@spec digits(String.t) :: [non_neg_integer]
def digits(number_string) do

end

@doc """
Generates sublists of a given size from a given string of numbers.
"""
@spec slices(String.t, non_neg_integer) :: [list(non_neg_integer)]
def slices(number_string, size) do

end

@doc """
Finds the largest product of a given number of consecutive numbers in a given string of numbers.
"""
Expand Down
45 changes: 0 additions & 45 deletions exercises/largest-series-product/largest_series_product_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,6 @@ ExUnit.configure exclude: :pending, trace: true
defmodule LargestSeriesProductTest do
use ExUnit.Case

# @tag :pending
test "digits" do
assert Series.digits("0123456789") == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
end

@tag :pending
test "same digits reversed" do
assert Series.digits("9876543210") == [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
end

@tag :pending
test "fewer digits" do
assert Series.digits("87654") == [8, 7, 6, 5, 4]
end

@tag :pending
test "some other digits" do
assert Series.digits("936923468") == [9, 3, 6, 9, 2, 3, 4, 6, 8]
end

@tag :pending
test "slices of zero" do
assert Series.digits("") == []
end

@tag :pending
test "slices of two" do
assert Series.slices("01234", 2) == [[0, 1], [1, 2], [2, 3], [3, 4]]
end

@tag :pending
test "other slices of two" do
assert Series.slices("98273463", 2) == [[9, 8], [8, 2], [2, 7], [7, 3], [3, 4], [4, 6], [6, 3]]
end

@tag :pending
test "slices of three" do
assert Series.slices("01234", 3) == [[0, 1, 2], [1, 2, 3], [2, 3, 4]]
end

@tag :pending
test "other slices of three" do
assert Series.slices("982347", 3) == [[9, 8, 2], [8, 2, 3], [2, 3, 4], [3, 4, 7]]
end

@tag :pending
test "largest product of 2" do
assert Series.largest_product("0123456789", 2) == 72
Expand Down

0 comments on commit 06977a1

Please sign in to comment.