Sha256: cffe931afae05c92e357529ceabbe32e41efc2df31c333445672a35937c3842e

Contents?: true

Size: 1.11 KB

Versions: 193

Compression:

Stored size: 1.11 KB

Contents

{-# OPTIONS_GHC -fno-warn-type-defaults #-}

import Spiral (spiral)

import Test.Hspec        (Spec, describe, it, shouldBe)
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)

main :: IO ()
main = hspecWith defaultConfig {configFastFail = True} specs

specs :: Spec
specs = describe "spiral" $ do

  it "empty spiral" $
    spiral 0 `shouldBe` []

  it "trivial spiral" $
    spiral 1 `shouldBe` [ [1] ]

  it "spiral of side length 2" $
    spiral 2 `shouldBe` [ [1, 2]
                        , [4, 3] ]

  it "spiral of side length 3" $
    spiral 3 `shouldBe` [ [1, 2, 3]
                        , [8, 9, 4]
                        , [7, 6, 5] ]

  it "spiral of side length 4" $
    spiral 4 `shouldBe` [ [ 1,  2,  3, 4]
                        , [12, 13, 14, 5]
                        , [11, 16, 15, 6]
                        , [10,  9,  8, 7] ]

  it "spiral of side length 5" $
    spiral 5 `shouldBe` [ [ 1,  2,  3,  4, 5]
                        , [16, 17, 18, 19, 6]
                        , [15, 24, 25, 20, 7]
                        , [14, 23, 22, 21, 8]
                        , [13, 12, 11, 10, 9] ]

Version data entries

193 entries across 193 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.179 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.178 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.177 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.176 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.175 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.174 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.173 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.172 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.171 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.170 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.169 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.167 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.166 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.165 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.164 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.163 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.162 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.161 tracks/haskell/exercises/spiral-matrix/test/Tests.hs
trackler-2.2.1.160 tracks/haskell/exercises/spiral-matrix/test/Tests.hs