diff options
| -rw-r--r-- | AufgabeFFP1.hs | 5 | ||||
| -rw-r--r-- | TestAufgabeFFP1.hs | 24 |
2 files changed, 29 insertions, 0 deletions
diff --git a/AufgabeFFP1.hs b/AufgabeFFP1.hs new file mode 100644 index 0000000..eb9d1fc --- /dev/null +++ b/AufgabeFFP1.hs | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | module AufgabeFFP1 | ||
| 2 | where | ||
| 3 | |||
| 4 | pof2s :: [Integer] | ||
| 5 | pof2s = map (2^) [0,1..] | ||
diff --git a/TestAufgabeFFP1.hs b/TestAufgabeFFP1.hs new file mode 100644 index 0000000..1380c17 --- /dev/null +++ b/TestAufgabeFFP1.hs | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | module Main where | ||
| 2 | |||
| 3 | import Test.HUnit | ||
| 4 | import Control.Monad | ||
| 5 | import AufgabeFFP1 | ||
| 6 | |||
| 7 | assertBoolF :: String -> Bool -> Assertion | ||
| 8 | assertBoolF msg b = when b (assertFailure msg) | ||
| 9 | |||
| 10 | ------------------------------------------------------------------------------- | ||
| 11 | |||
| 12 | pof2s1 :: Test | ||
| 13 | pof2s1 = TestCase (assertEqual "pof2s" [1,2,4,8,16,32,64,128,256,512] (take 10 pof2s)) | ||
| 14 | |||
| 15 | pof2sTests = TestList [pof2s1] | ||
| 16 | |||
| 17 | ------------------------------------------------------------------------------- | ||
| 18 | |||
| 19 | tests :: [Test] | ||
| 20 | tests = [pof2s1] | ||
| 21 | |||
| 22 | main = do | ||
| 23 | forM tests $ \test -> | ||
| 24 | runTestTT test | ||
