Browse Source

Version Fonctionnelle : Tests OK (TAF -> ReadMe)

Paul Faure 3 years ago
parent
commit
5f64489458
7 changed files with 253 additions and 25 deletions
  1. 2
    1
      Makefile
  2. 138
    0
      src/labelflotcosttest.ml
  3. 73
    17
      src/labelflottest.ml
  4. 23
    2
      src/pathtest.ml
  5. 8
    0
      src/test.ml
  6. 5
    1
      src/test.mli
  7. 4
    4
      src/toolstest.ml

+ 2
- 1
Makefile View File

@@ -9,7 +9,7 @@ default :
9 9
 man:
10 10
 	@echo "Ce Makefile permet la compilation et l'exécution du code Ocaml lié au projet Ocaml de 4IR codé par TALI Elies et FAURE Paul"
11 11
 	@echo "L'objectif de ce projet était d'implémenter l'algorithme de Ford Fulkerson (V1), et de l'utiliser pour un cas particulier (ici, l'affectation de taches) (V2)\n"
12
-	@echo "Ce projet a été divisé en package :\n  - LabelFlot : gérant les labels des graphes de flot\n  - Path : gérant les chemins dans les graphes\n  - Tools : des outils pour travailler sur les graphes"
12
+	@echo "Ce projet a été divisé en package :\n  - LabelFlotCost : gérant les labels des graphes de flot avec prise en compte du cout\n  - LabelFlot : gérant les labels des graphes de flot\n  - Path : gérant les chemins dans les graphes\n  - Tools : des outils pour travailler sur les graphes"
13 13
 	@echo "\nTous ces modules sont testables (fichier de type 'nom_package'test.ml) grace au module test créé"
14 14
 	@echo "Il est possible de compiler ces fichiers de test avec la cible build_'nom_package'test, un fichier 'nom_package'test.native sera crée"
15 15
 	@echo "Il est possible d'executer ces fichiers de test avec la cible demo_'nom_package'test\n"
@@ -54,6 +54,7 @@ demo_%test: % build_%test
54 54
 	@echo "\n==== EXECUTING" $< "====\n"
55 55
 	./$<test.native
56 56
 
57
+labelflotcost:
57 58
 labelflot:
58 59
 path:
59 60
 tools:

+ 138
- 0
src/labelflotcosttest.ml View File

@@ -0,0 +1,138 @@
1
+open Labelflotcost
2
+open Test
3
+
4
+
5
+(* NB : Constructeurs, Setteurs, et Getteurs ne seront pas testés *)
6
+let () = 
7
+
8
+  Printf.printf "Début de la procédure de test du package Labelflot\n\n\n%!";
9
+
10
+  let test_list = [
11
+    (* reduce_current_flot *)
12
+    (reduce_current_flot (set_current_flot (new_label_cap 10) 10) 2, set_current_flot (new_label_cap 10) 8, "reduce_current_flot -> (10/10) -> 2", label_flot_to_string);
13
+    (reduce_current_flot (set_current_flot (new_label_cap 10) 3) 2, set_current_flot (new_label_cap 10) 1, "reduce_current_flot -> (3/10) -> 2", label_flot_to_string);
14
+    (reduce_current_flot (set_current_flot (new_label_cap 10) 3) 0, set_current_flot (new_label_cap 10) 3, "reduce_current_flot -> (3/10) -> 0", label_flot_to_string);
15
+    (reduce_current_flot (set_current_flot (new_label_cap 10) 10) 10, (new_label_cap 10), "reduce_current_flot -> (10/10) -> 10", label_flot_to_string);
16
+  ]
17
+  in 
18
+  if apply_test_procedure test_list then
19
+
20
+    let test_list = [
21
+      (* reduce_current_flot *)
22
+      (reduce_current_flot (set_current_flot (new_label_cap 10) 10) 2, set_current_flot (new_label_cap 10) 8, "reduce_current_flot -> (10/10) -> 2", label_flot_to_string);
23
+      (reduce_current_flot (set_current_flot (new_label_cap 10) 3) 2, set_current_flot (new_label_cap 10) 1, "reduce_current_flot -> (3/10) -> 2", label_flot_to_string);
24
+      (reduce_current_flot (set_current_flot (new_label_cap 10) 3) 0, set_current_flot (new_label_cap 10) 3, "reduce_current_flot -> (3/10) -> 0", label_flot_to_string);
25
+      (reduce_current_flot (set_current_flot (new_label_cap 10) 10) 10, (new_label_cap 10), "reduce_current_flot -> (10/10) -> 10", label_flot_to_string);
26
+    ]
27
+    in 
28
+    if apply_test_procedure test_list then
29
+
30
+      let test_list = [
31
+        (* add_current_flot *)
32
+        (add_current_flot (new_label_cap 10) 2, set_current_flot (new_label_cap 10) 2, "add_current_flot -> (0/10) -> 2", label_flot_to_string);
33
+        (add_current_flot (set_current_flot (new_label_cap 10) 3) 2, set_current_flot (new_label_cap 10) 5, "add_current_flot -> (3/10) -> 2", label_flot_to_string);
34
+        (add_current_flot (new_label_cap 10) 0, (new_label_cap 10), "add_current_flot -> (0/10) -> 0", label_flot_to_string);
35
+      ]
36
+      in 
37
+      if apply_test_procedure test_list then
38
+
39
+        let test_list = [
40
+          (* compare_current_flot *)
41
+          (compare_current_flot (new_label_cap 10) (set_current_flot (new_label_cap 10) 10), true, "compare_current_flot -> (0/10) -> (10/10)", (fun x -> if x then "True" else "False"));
42
+          (compare_current_flot (set_current_flot (new_label_cap 10) 10) (new_label_cap 10), false, "compare_current_flot -> (10/10) -> (0/10)", (fun x -> if x then "True" else "False"));
43
+          (compare_current_flot (new_label_cap 10) (new_label_cap 10), false, "compare_current_flot -> (0/10) -> (0/10)", (fun x -> if x then "True" else "False"));
44
+        ]
45
+        in 
46
+        if apply_test_procedure test_list then
47
+
48
+          let test_list = [
49
+            (* Label écart *)
50
+            (label_ecart (new_label_cap 10), set_current_flot (new_label_cap 10) 10, "label_ecart -> (0, 10) -> label_flot", label_flot_to_string);
51
+            (label_ecart (set_current_flot (new_label_cap 10) 10), new_label_cap 10, "label_ecart -> (10, 10) -> label_flot", label_flot_to_string);
52
+            (label_ecart (set_current_flot (new_label_cap 10) 4), set_current_flot (new_label_cap 10) 6, "label_ecart -> (4, 10) -> label_flot", label_flot_to_string)
53
+          ]
54
+          in 
55
+          if apply_test_procedure test_list then
56
+
57
+            let test_list = [
58
+              (* Label écart reverse *)
59
+              (label_ecart_reverse (new_label_cap_cost 10 7), new_label_cap_cost 10 (-7), "label_ecart_reverse -> (0/10):7 -> label_flot", label_flot_to_string);
60
+              (label_ecart_reverse (new_label_cap_cost 10 0), new_label_cap_cost 10 0, "label_ecart_reverse -> (0/10):0 -> label_flot", label_flot_to_string);
61
+              (label_ecart_reverse (new_label_cap_cost 10 (-7)), new_label_cap_cost 10 7, "label_ecart_reverse -> (0/10):-7 -> label_flot", label_flot_to_string)
62
+            ]
63
+            in 
64
+            if apply_test_procedure test_list then
65
+
66
+              let test_list = [
67
+                (* compare costs *)
68
+                (compare (set_current_flot (new_label_cap_cost 10 7) 4) (set_current_flot (new_label_cap_cost 3 5) 2), true, "compare -> (4/10):7 -> (2/3):5", (fun x -> if x then "true" else "false"));
69
+                (compare (set_current_flot (new_label_cap_cost 10 5) 4) (set_current_flot (new_label_cap_cost 3 7) 2), false, "compare -> (4/10):5 -> (2/3):7", (fun x -> if x then "true" else "false"));
70
+                (compare (set_current_flot (new_label_cap_cost 10 (-7)) 0) (set_current_flot (new_label_cap_cost 3 5) 3), false, "compare -> (0/10):-7 -> (3/3):5", (fun x -> if x then "true" else "false"));
71
+                (compare (set_current_flot (new_label_cap_cost 10 7) 4) (set_current_flot (new_label_cap_cost 3 (-5)) 2), true, "compare -> (4/10):7 -> (2/3):-5", (fun x -> if x then "true" else "false"));
72
+                (compare (set_current_flot (new_label_cap_cost 10 (-7)) 4) (set_current_flot (new_label_cap_cost 3 (-5)) 2), false, "compare -> (4/10):-7 -> (2/3):-5", (fun x -> if x then "true" else "false"));
73
+                (compare (set_current_flot (new_label_cap_cost 10 (-5)) 4) (set_current_flot (new_label_cap_cost 3 (-7)) 2), true, "compare -> (4/10):-5 -> (2/3):-7", (fun x -> if x then "true" else "false"));
74
+                (compare (set_current_flot (new_label_cap_cost 10 0) 4) (set_current_flot (new_label_cap_cost 3 5) 2), false, "compare -> (4/10):0 -> (2/3):5", (fun x -> if x then "true" else "false"))
75
+              ]
76
+              in 
77
+              if apply_test_procedure test_list then
78
+
79
+                let test_list = [
80
+                  (* sum costs *)
81
+                  (sum (set_current_flot (new_label_cap_cost 10 (-7)) 4) (set_current_flot (new_label_cap_cost 3 (-5)) 2), (set_current_flot (new_label_cap_cost 10 (-12)) 4), "sum -> (4/10):-7 -> (2/3):-5", label_flot_to_string);
82
+                  (sum (set_current_flot (new_label_cap_cost 10 (7)) 4) (set_current_flot (new_label_cap_cost 3 (5)) 2), (set_current_flot (new_label_cap_cost 10 (12)) 4), "sum -> (4/10):7 -> (2/3):5", label_flot_to_string);
83
+                  (sum (set_current_flot (new_label_cap_cost 10 (0)) 4) (set_current_flot (new_label_cap_cost 3 (-5)) 2), (set_current_flot (new_label_cap_cost 10 (-5)) 4), "sum -> (4/10):0 -> (2/3):-5", label_flot_to_string);
84
+                  (sum (set_current_flot (new_label_cap_cost 10 (0)) 4) (set_current_flot (new_label_cap_cost 3 (0)) 2), (set_current_flot (new_label_cap_cost 10 (0)) 4), "sum -> (4/10):-7 -> (2/3):-5", label_flot_to_string)
85
+                ]
86
+                in 
87
+                if apply_test_procedure test_list then
88
+
89
+                  let test_list = [
90
+                    (* Validité des flots *)
91
+                    (label_flot_valid (set_current_flot (new_label_cap 10) 4), true, "label_flot_valid -> (4, 10) -> bool", (fun x -> if x then "true" else "false"));
92
+                    (label_flot_valid (set_current_flot (new_label_cap 10) 0), true, "label_flot_valid -> (0, 10) -> bool", (fun x -> if x then "true" else "false"));
93
+                    (label_flot_valid (set_current_flot (new_label_cap 10) 10), true, "label_flot_valid -> (10, 10) -> bool", (fun x -> if x then "true" else "false"));
94
+                    (label_flot_valid (set_current_flot (new_label_cap 0) 0), true, "label_flot_valid -> (0, 0) -> bool", (fun x -> if x then "true" else "false"));
95
+                    (label_flot_valid (set_current_flot (new_label_cap 10) (-1)), false, "label_flot_valid -> (-1, 10) -> bool", (fun x -> if x then "true" else "false"));
96
+                    (label_flot_valid (set_current_flot (new_label_cap 10) 11), false, "label_flot_valid -> (11, 10) -> bool", (fun x -> if x then "true" else "false"))
97
+                  ]
98
+                  in 
99
+                  if apply_test_procedure test_list then
100
+
101
+                    let test_list = [
102
+                      (* Flot -> string *)
103
+                      (label_flot_to_string (set_current_flot (new_label_cap 10) 4), "(4/10):0", "label_flot_to_string -> (4, 10) -> string", (fun x -> x));
104
+                      (label_flot_to_string (set_current_flot (new_label_cap 0) 0), "(0/0):0", "label_flot_to_string -> (0, 0) -> string", (fun x -> x))
105
+                    ]
106
+                    in 
107
+                    if apply_test_procedure test_list then
108
+
109
+                      let test_list = [
110
+                        (* string -> Flot *)
111
+                        (string_to_label_flot "(4/10):0", (set_current_flot (new_label_cap 10) 4), "string_to_label_flot -> \"(4/10):0\"", label_flot_to_string);
112
+                        (string_to_label_flot "(0/0):0", (set_current_flot (new_label_cap 0) 0), "string_to_label_flot -> \"(0/0):0\"", label_flot_to_string)
113
+                      ]
114
+                      in 
115
+                      let _null = apply_test_procedure test_list in
116
+
117
+                      Printf.printf "Fin de la procédure de test du package Labelflot. PROCEDURE COMPLETED\n%!"
118
+
119
+                    else
120
+                      Printf.printf "Procédure de test annulée\n%!"
121
+                  else
122
+                    Printf.printf "Procédure de test annulée\n%!"
123
+                else
124
+                  Printf.printf "Procédure de test annulée\n%!"
125
+              else
126
+                Printf.printf "Procédure de test annulée\n%!"
127
+            else
128
+              Printf.printf "Procédure de test annulée\n%!"
129
+          else
130
+            Printf.printf "Procédure de test annulée\n%!"
131
+        else
132
+          Printf.printf "Procédure de test annulée\n%!"
133
+      else
134
+        Printf.printf "Procédure de test annulée\n%!"
135
+    else
136
+      Printf.printf "Procédure de test annulée\n%!"
137
+  else
138
+    Printf.printf "Procédure de test annulée\n%!"

+ 73
- 17
src/labelflottest.ml View File

@@ -8,37 +8,93 @@ let () =
8 8
   Printf.printf "Début de la procédure de test du package Labelflot\n\n\n%!";
9 9
 
10 10
   let test_list = [
11
-    (* Label écart *)
12
-    (label_ecart (new_label_cap 10), set_current_flot (new_label_cap 10) 10, "label_ecart -> (0, 10) -> label_flot", label_flot_to_string);
13
-    (label_ecart (set_current_flot (new_label_cap 10) 10), new_label_cap 10, "label_ecart -> (10, 10) -> label_flot", label_flot_to_string);
14
-    (label_ecart (set_current_flot (new_label_cap 10) 4), set_current_flot (new_label_cap 10) 6, "label_ecart -> (4, 10) -> label_flot", label_flot_to_string)
11
+    (* reduce_current_flot *)
12
+    (reduce_current_flot (set_current_flot (new_label_cap 10) 10) 2, set_current_flot (new_label_cap 10) 8, "reduce_current_flot -> (10/10) -> 2", label_flot_to_string);
13
+    (reduce_current_flot (set_current_flot (new_label_cap 10) 3) 2, set_current_flot (new_label_cap 10) 1, "reduce_current_flot -> (3/10) -> 2", label_flot_to_string);
14
+    (reduce_current_flot (set_current_flot (new_label_cap 10) 3) 0, set_current_flot (new_label_cap 10) 3, "reduce_current_flot -> (3/10) -> 0", label_flot_to_string);
15
+    (reduce_current_flot (set_current_flot (new_label_cap 10) 10) 10, (new_label_cap 10), "reduce_current_flot -> (10/10) -> 10", label_flot_to_string);
15 16
   ]
16 17
   in 
17 18
   if apply_test_procedure test_list then
18 19
 
19 20
     let test_list = [
20
-      (* Validité des flots *)
21
-      (label_flot_valid (set_current_flot (new_label_cap 10) 4), true, "label_flot_valid -> (4, 10) -> bool", (fun x -> if x then "true" else "false"));
22
-      (label_flot_valid (set_current_flot (new_label_cap 10) 0), true, "label_flot_valid -> (0, 10) -> bool", (fun x -> if x then "true" else "false"));
23
-      (label_flot_valid (set_current_flot (new_label_cap 10) 10), true, "label_flot_valid -> (10, 10) -> bool", (fun x -> if x then "true" else "false"));
24
-      (label_flot_valid (set_current_flot (new_label_cap 0) 0), true, "label_flot_valid -> (0, 0) -> bool", (fun x -> if x then "true" else "false"));
25
-      (label_flot_valid (set_current_flot (new_label_cap 10) (-1)), false, "label_flot_valid -> (-1, 10) -> bool", (fun x -> if x then "true" else "false"));
26
-      (label_flot_valid (set_current_flot (new_label_cap 10) 11), false, "label_flot_valid -> (11, 10) -> bool", (fun x -> if x then "true" else "false"))
21
+      (* reduce_current_flot *)
22
+      (reduce_current_flot (set_current_flot (new_label_cap 10) 10) 2, set_current_flot (new_label_cap 10) 8, "reduce_current_flot -> (10/10) -> 2", label_flot_to_string);
23
+      (reduce_current_flot (set_current_flot (new_label_cap 10) 3) 2, set_current_flot (new_label_cap 10) 1, "reduce_current_flot -> (3/10) -> 2", label_flot_to_string);
24
+      (reduce_current_flot (set_current_flot (new_label_cap 10) 3) 0, set_current_flot (new_label_cap 10) 3, "reduce_current_flot -> (3/10) -> 0", label_flot_to_string);
25
+      (reduce_current_flot (set_current_flot (new_label_cap 10) 10) 10, (new_label_cap 10), "reduce_current_flot -> (10/10) -> 10", label_flot_to_string);
27 26
     ]
28 27
     in 
29 28
     if apply_test_procedure test_list then
30 29
 
31 30
       let test_list = [
32
-        (* Flot -> string *)
33
-        (label_flot_to_string (set_current_flot (new_label_cap 10) 4), "(4/10)", "label_flot_to_string -> (4, 10) -> string", (fun x -> x));
34
-        (label_flot_to_string (set_current_flot (new_label_cap 0) 0), "(0/0)", "label_flot_to_string -> (0, 0) -> string", (fun x -> x))
31
+        (* add_current_flot *)
32
+        (add_current_flot (new_label_cap 10) 2, set_current_flot (new_label_cap 10) 2, "add_current_flot -> (0/10) -> 2", label_flot_to_string);
33
+        (add_current_flot (set_current_flot (new_label_cap 10) 3) 2, set_current_flot (new_label_cap 10) 5, "add_current_flot -> (3/10) -> 2", label_flot_to_string);
34
+        (add_current_flot (new_label_cap 10) 0, (new_label_cap 10), "add_current_flot -> (0/10) -> 0", label_flot_to_string);
35 35
       ]
36 36
       in 
37
-      let _null = apply_test_procedure test_list in
37
+      if apply_test_procedure test_list then
38 38
 
39
-      Printf.printf "Fin de la procédure de test du package Labelflot. PROCEDURE COMPLETED\n%!"
39
+        let test_list = [
40
+          (* compare_current_flot *)
41
+          (compare_current_flot (new_label_cap 10) (set_current_flot (new_label_cap 10) 10), true, "compare_current_flot -> (0/10) -> (10/10)", (fun x -> if x then "True" else "False"));
42
+          (compare_current_flot (set_current_flot (new_label_cap 10) 10) (new_label_cap 10), false, "compare_current_flot -> (10/10) -> (0/10)", (fun x -> if x then "True" else "False"));
43
+          (compare_current_flot (new_label_cap 10) (new_label_cap 10), false, "compare_current_flot -> (0/10) -> (0/10)", (fun x -> if x then "True" else "False"));
44
+        ]
45
+        in 
46
+        if apply_test_procedure test_list then
40 47
 
48
+          let test_list = [
49
+            (* Label écart *)
50
+            (label_ecart (new_label_cap 10), set_current_flot (new_label_cap 10) 10, "label_ecart -> (0, 10) -> label_flot", label_flot_to_string);
51
+            (label_ecart (set_current_flot (new_label_cap 10) 10), new_label_cap 10, "label_ecart -> (10, 10) -> label_flot", label_flot_to_string);
52
+            (label_ecart (set_current_flot (new_label_cap 10) 4), set_current_flot (new_label_cap 10) 6, "label_ecart -> (4, 10) -> label_flot", label_flot_to_string)
53
+          ]
54
+          in 
55
+          if apply_test_procedure test_list then
56
+
57
+            let test_list = [
58
+              (* Validité des flots *)
59
+              (label_flot_valid (set_current_flot (new_label_cap 10) 4), true, "label_flot_valid -> (4, 10) -> bool", (fun x -> if x then "true" else "false"));
60
+              (label_flot_valid (set_current_flot (new_label_cap 10) 0), true, "label_flot_valid -> (0, 10) -> bool", (fun x -> if x then "true" else "false"));
61
+              (label_flot_valid (set_current_flot (new_label_cap 10) 10), true, "label_flot_valid -> (10, 10) -> bool", (fun x -> if x then "true" else "false"));
62
+              (label_flot_valid (set_current_flot (new_label_cap 0) 0), true, "label_flot_valid -> (0, 0) -> bool", (fun x -> if x then "true" else "false"));
63
+              (label_flot_valid (set_current_flot (new_label_cap 10) (-1)), false, "label_flot_valid -> (-1, 10) -> bool", (fun x -> if x then "true" else "false"));
64
+              (label_flot_valid (set_current_flot (new_label_cap 10) 11), false, "label_flot_valid -> (11, 10) -> bool", (fun x -> if x then "true" else "false"))
65
+            ]
66
+            in 
67
+            if apply_test_procedure test_list then
68
+
69
+              let test_list = [
70
+                (* Flot -> string *)
71
+                (label_flot_to_string (set_current_flot (new_label_cap 10) 4), "(4/10)", "label_flot_to_string -> (4, 10) -> string", (fun x -> x));
72
+                (label_flot_to_string (set_current_flot (new_label_cap 0) 0), "(0/0)", "label_flot_to_string -> (0, 0) -> string", (fun x -> x))
73
+              ]
74
+              in 
75
+              if apply_test_procedure test_list then
76
+
77
+                let test_list = [
78
+                  (* string -> Flot *)
79
+                  (string_to_label_flot "(4/10)", (set_current_flot (new_label_cap 10) 4), "string_to_label_flot -> \"(4/10)\"", label_flot_to_string);
80
+                  (string_to_label_flot "(0/0)", (set_current_flot (new_label_cap 0) 0), "string_to_label_flot -> \"(0/0)\"", label_flot_to_string)
81
+                ]
82
+                in 
83
+                let _null = apply_test_procedure test_list in
84
+
85
+                Printf.printf "Fin de la procédure de test du package Labelflot. PROCEDURE COMPLETED\n%!"
86
+
87
+              else
88
+                Printf.printf "Procédure de test annulée\n%!"
89
+            else
90
+              Printf.printf "Procédure de test annulée\n%!"
91
+          else
92
+            Printf.printf "Procédure de test annulée\n%!"
93
+        else
94
+          Printf.printf "Procédure de test annulée\n%!"
95
+      else
96
+        Printf.printf "Procédure de test annulée\n%!"
41 97
     else
42 98
       Printf.printf "Procédure de test annulée\n%!"
43 99
   else
44
-    Printf.printf "Procédure de test annulée\n%!"
100
+    Printf.printf "Procédure de test annulée\n%!"

+ 23
- 2
src/pathtest.ml View File

@@ -85,10 +85,31 @@ let () =
85 85
                     (path_to_string string_of_int (new_arc_in_path (new_arc_in_path (new_arc_in_path empty_path 3 4 17) 2 3 15) 1 2 7), "(1)----7---->(2)----15---->(3)----17---->(4)", "path_to_string",  (fun x -> x))
86 86
                   ]
87 87
                   in 
88
-                  let _null = apply_test_procedure test_list in
88
+                  if apply_test_procedure test_list then
89 89
 
90
-                  Printf.printf "Fin de la procédure de test du package Path. PROCEDURE COMPLETED\n%!"
90
+                    let test_list = [
91
+                      (* get_minimum_label *)
92
+                      (get_minimum_label (fun a b -> a < b) (new_arc_in_path empty_path 1 2 7), 7, "get_minimum_label",  (fun x -> string_of_int x));
93
+                      (get_minimum_label (fun a b -> a < b) (new_arc_in_path (new_arc_in_path empty_path 1 2 7) 3 1 5), 5, "get_minimum_label",  (fun x -> string_of_int x));
94
+                      (get_minimum_label (fun a b -> a < b) (new_arc_in_path (new_arc_in_path (new_arc_in_path empty_path 1 2 7) 3 1 5) 5 3 2), 2, "get_minimum_label",  (fun x -> string_of_int x));
95
+                      (get_minimum_label (fun a b -> a < b) (new_arc_in_path (new_arc_in_path (new_arc_in_path empty_path 1 2 4) 3 1 5) 5 3 7), 4, "get_minimum_label",  (fun x -> string_of_int x));
96
+                    ]
97
+                    in 
98
+                    if apply_test_procedure test_list then
91 99
 
100
+                      let test_list = [
101
+                        (* get_destination exception *)
102
+                        (test_exception_2_param get_minimum_label (fun a b -> a < b) empty_path Empty_path, true, "get_minimum_label", (fun x -> if x then "Exception Raised" else "Exception Unraised"))
103
+                      ]
104
+                      in 
105
+                      let _null = apply_test_procedure test_list in
106
+
107
+                      Printf.printf "Fin de la procédure de test du package Path. PROCEDURE COMPLETED\n%!"
108
+
109
+                    else
110
+                      Printf.printf "Procédure de test annulée\n%!"
111
+                  else
112
+                    Printf.printf "Procédure de test annulée\n%!"
92 113
                 else
93 114
                   Printf.printf "Procédure de test annulée\n%!"
94 115
               else

+ 8
- 0
src/test.ml View File

@@ -73,4 +73,12 @@ let test_exception f param excep =
73 73
   try let _retour = f param in
74 74
     false
75 75
   with
76
+    excep -> true
77
+
78
+(* Fonction utilisée pour tester des fonctions levant une exception
79
+   NE FONCTIONNE QUE SUR DES FONCTIONS A 2 PARAMETREs *)
80
+let test_exception_2_param f param param2 excep = 
81
+  try let _retour = f param param2 in
82
+    false
83
+  with
76 84
     excep -> true

+ 5
- 1
src/test.mli View File

@@ -6,4 +6,8 @@ val apply_test_procedure: ('a * 'a * string * ('a -> string)) list -> bool
6 6
 
7 7
 (* Fonction utilisée pour tester des fonctions levant une exception
8 8
    NE FONCTIONNE QUE SUR DES FONCTIONS A UN PARAMETRE *)
9
-val test_exception: ('a -> 'b) -> 'a -> exn -> bool
9
+val test_exception: ('a -> 'b) -> 'a -> exn -> bool
10
+
11
+(* Fonction utilisée pour tester des fonctions levant une exception
12
+   NE FONCTIONNE QUE SUR DES FONCTIONS A 2 PARAMETREs *)
13
+val test_exception_2_param: ('a -> 'b -> 'c) -> 'a -> 'b -> exn -> bool

+ 4
- 4
src/toolstest.ml View File

@@ -51,10 +51,10 @@ let () =
51 51
           let resultUpdate3 = update graph path_test (fun x -> string_of_int ((int_of_string x) +2)) (fun x -> string_of_int ((int_of_string x) -2)) in 
52 52
           let path_test = empty_path in
53 53
           let resultUpdate4 = update graph path_test (fun x -> string_of_int ((int_of_string x) +2)) (fun x -> string_of_int ((int_of_string x) -2)) in 
54
-          let () = export  "graphs/tests/resultUpdate1" resultUpdate1 in 
55
-          let () = export  "graphs/tests/resultUpdate2" resultUpdate2 in 
56
-          let () = export  "graphs/tests/resultUpdate3" resultUpdate3 in 
57
-          let () = export  "graphs/tests/resultUpdate4" resultUpdate4 in 
54
+          let () = export  "graphs/int/resultUpdate1" resultUpdate1 in 
55
+          let () = export  "graphs/int/resultUpdate2" resultUpdate2 in 
56
+          let () = export  "graphs/int/resultUpdate3" resultUpdate3 in 
57
+          let () = export  "graphs/int/resultUpdate4" resultUpdate4 in 
58 58
 
59 59
           let test_list = [
60 60
             (*update, nothing on screen, see files*)

Loading…
Cancel
Save