Skip to content

Commit

Permalink
Merge pull request #98 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
kytrinyx committed Mar 22, 2016
2 parents 6b9238c + b56ae34 commit fa6c423
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
2 changes: 1 addition & 1 deletion largest-series-product/example.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Series (digits, slices, largestProduct) where
module Series (largestProduct) where
import Data.Char (digitToInt)
import Data.List (tails)

Expand Down
15 changes: 2 additions & 13 deletions largest-series-product/largest-series-product_test.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Test.HUnit (Assertion, (@=?), runTestTT, Test(..), Counts(..))
import System.Exit (ExitCode(..), exitWith)
import Series (digits, slices, largestProduct)
import Series (largestProduct)

exitProperly :: IO Counts -> IO ()
exitProperly m = do
Expand All @@ -15,9 +15,6 @@ main = exitProperly $ runTestTT $ TestList
[ TestList seriesTests ]

-- Allow implementations that work with Integral to compile without warning
ints :: [Int] -> [Int]
ints = id

int :: Int -> Maybe Int
int = Just

Expand All @@ -26,15 +23,7 @@ intNothing = Nothing

seriesTests :: [Test]
seriesTests = map TestCase
[ ints [0..9] @=? digits ['0'..'9']
, ints [9,8..0] @=? digits ['9','8'..'0']
, ints [8,7..4] @=? digits ['8','7'..'4']
, ints [9, 3, 6, 9, 2, 3, 4, 6, 8] @=? digits "936923468"
, map ints [[9, 8], [8, 2], [2, 7], [7, 3], [3, 4], [4, 6], [6, 3]] @=?
slices 2 "98273463"
, map ints [[9, 8, 2], [8, 2, 3], [2, 3, 4], [3, 4, 7]] @=?
slices 3 "982347"
, int 72 @=? largestProduct 2 "0123456789"
[ int 72 @=? largestProduct 2 "0123456789"
, int 2 @=? largestProduct 2 "12"
, int 9 @=? largestProduct 2 "19"
, int 48 @=? largestProduct 2 "576802143"
Expand Down

0 comments on commit fa6c423

Please sign in to comment.