summaryrefslogtreecommitdiffstats
path: root/TestAufgabeFFP2.hs
blob: ef6d48a47a32f02af8f9d54d044ef1252d53a1ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module Main where

import Test.HUnit
import Control.Monad
import AufgabeFFP2

cases1 = TestLabel "pps" $ TestList [
  TestCase $ assertEqual "take 10 pps"
    [(3,5),(5,7),(11,13),(17,19),(29,31),(41,43), (59,61),(71,73),(101,103),(107,109)]
    (take 10 pps),
  TestCase $ assertEqual "pps!!20" (347,349) (pps!!20),
  TestCase $ assertEqual "head (drop 30 pps)" (809,811) (head (drop 30 pps))
  ]


cases2 = TestLabel "powFast" $ TestList [
  TestCase $ assertEqual "powFast 10" 1024     (powFast 10),
  TestCase $ assertEqual "powFast 10" (pow 10) (powFast 10),
  TestCase $ assertEqual "powFast 20" 1048576  (powFast 20),
  TestCase $ assertEqual "powFast 20" (pow 20) (powFast 20)
  ]

cases3 = TestLabel "fMT/f" $ TestList [
  TestCase $ assertEqual "fMT/f 10 10"   (fMT 10 10)   (f 10 10),
  TestCase $ assertEqual "fMT/f 50 10"   (fMT 50 10)   (f 50 10),
  TestCase $ assertEqual "fMT/f 1000 10" (fMT 1000 10) (f 1000 10)
  ]

cases4 = TestLabel "gz/gzs" $ TestList [
  TestCase $ assertEqual "gz 42"    144 (gz 42),
  TestCase $ assertEqual "gz 402"   400 (gz 402),
  TestCase $ assertEqual "gzs!!42"  144 (gzs!!42),
  TestCase $ assertEqual "gzs!!402" 400 (gzs!!402)
  ]

tests :: [Test]
tests = [cases1, cases2, cases3, cases4]

main = do
  forM tests $ \test ->
    runTestTT test