Skip to content

Commit 5083c95

Browse files
committed
Solve 'Lario and Muigi Pipe Problem' kata
1 parent 9f14d07 commit 5083c95

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/Pipes.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Pipes (pipeFix) where
2+
3+
-- https://www.codewars.com/kata/56b29582461215098d00000f/train/haskell
4+
5+
pipeFix :: [Int] -> [Int]
6+
pipeFix numbers = [head numbers .. last numbers]

test/PipesSpec.hs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module PipesSpec where
2+
3+
import Pipes (pipeFix)
4+
import Test.Hspec
5+
6+
spec :: Spec
7+
spec = do
8+
describe "Fixed Tests" $ do
9+
it "Basic Test Cases" $ do
10+
pipeFix [1, 2, 3, 5, 6, 8, 9] `shouldBe` [1, 2, 3, 4, 5, 6, 7, 8, 9]
11+
pipeFix [1, 2, 3, 12] `shouldBe` [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
12+
pipeFix [6, 9] `shouldBe` [6, 7, 8, 9]
13+
pipeFix [-1, 4] `shouldBe` [-1, 0, 1, 2, 3, 4]
14+
pipeFix [1, 2, 3] `shouldBe` [1, 2, 3]

0 commit comments

Comments
 (0)