-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestDibujo.hs
70 lines (53 loc) · 2.22 KB
/
TestDibujo.hs
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import Dibujo
import Test.HUnit
-- Test Figura
testFigura =
TestCase(assertEqual "Figura Cuadrado" (Figura "Cuadrado")
(figura "Cuadrado"))
-- Test funciones
testRotar =
TestCase(assertEqual "Rotar" (Rotar (Figura "Cuadrado"))
(rotar(figura "Cuadrado")))
-- Test Espejar
testEspejar =
TestCase(assertEqual "Espejar" (Espejar (Figura "Cuadrado"))
(espejar(figura "Cuadrado")))
-- Test Rot45
testRotar45 =
TestCase(assertEqual "Rotar45" (Rot45 (Figura "Cuadrado"))
(rot45(figura "Cuadrado")))
-- Test Apilar
testApilar =
TestCase(assertEqual "Apilar" (Apilar 1.0 1.0 (Figura "Cuadrado") (Figura "Circulo"))
(apilar 1.0 1.0 (figura "Cuadrado") (figura "Circulo")))
-- Test Juntar
testJuntar =
TestCase(assertEqual "Juntar" (Juntar 1.0 1.0 (Figura "Cuadrado")
(Figura "Circulo")) (juntar 1.0 1.0 (figura "Cuadrado") (figura "Circulo")))
-- Test Encimar
testEncimar =
TestCase(assertEqual "Encimar" (Encimar (Figura "Cuadrado")
(Figura "Circulo")) (encimar (figura "Cuadrado") (figura "Circulo")))
-- Test Composicion
testComp =
TestCase(assertEqual "Test composicion" (1+1+1) (comp (+1) 3 0))
-- Test r180
testR180 =
TestCase(assertEqual "Test r180" (Rotar(Rotar(Figura "Cuadrado")))
(r180 (figura "Cuadrado")))
-- Test r270
testR270 =
TestCase(assertEqual "Test r270" (Rotar(Rotar(Rotar(Figura "Cuadrado"))))
(r270 (figura "Cuadrado")))
-- Test figuras (incluye folddib)
testFiguras = TestCase(assertEqual "Test figuras y foldDib" ["Cuadrado", "Circulo"]
(figuras (Apilar 1.0 1.0 (Figura "Cuadrado") (Figura "Circulo"))))
-- Test MapDib
testMapDib = TestCase (assertEqual "Test mapDib" (Figura "Cuadrado") (mapDib figura (Figura "Cuadrado")))
-- Test ciclar
testCiclar = TestCase (assertEqual "Test ciclar" (cuarteto (Figura "Cuadrado")
(rotar (Figura "Cuadrado")) (r180 (Figura "Cuadrado")) (r270 (Figura "Cuadrado")))
(ciclar (figura "Cuadrado")))
testDibujo =
TestList [testFigura, testRotar, testEspejar, testRotar45, testApilar, testJuntar, testComp, testR180, testR270, testFiguras, testMapDib, testCiclar]
main = runTestTT testDibujo