Sha256: 68166b07fc6fdafbe7dd4cba877f6191787c45bdba19d554ed7b15702d2f7916
Contents?: true
Size: 1.19 KB
Versions: 84
Compression:
Stored size: 1.19 KB
Contents
{-# OPTIONS_GHC -fno-warn-type-defaults #-} import Data.Foldable (for_) import Test.Hspec (Spec, describe, it, shouldBe) import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith) import PrimeFactors (primeFactors) main :: IO () main = hspecWith defaultConfig {configFastFail = True} specs specs :: Spec specs = describe "prime-factors" $ describe "primeFactors" $ for_ cases test where test (n, expected) = it explanation assertion where explanation = show n assertion = primeFactors n `shouldBe` expected -- As of 2016-07-31, there was no reference file -- for the test cases in `exercism/x-common`. cases = [ ( 1, [] ) , ( 2, [2] ) , ( 3, [3] ) , ( 4, [2, 2] ) , ( 6, [2, 3] ) , ( 8, [2, 2, 2] ) , ( 9, [3, 3] ) , ( 27, [3, 3, 3] ) , ( 625, [5, 5, 5, 5] ) , ( 901255, [5, 17, 23, 461] ) , (93819012551, [11, 9539, 894119] ) ]
Version data entries
84 entries across 84 versions & 1 rubygems