Skip to content

Commit 9d1f6b7

Browse files
committed
Correct messages for assumption tests with CWStopOnFailure 0
1 parent c08b0d9 commit 9d1f6b7

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

cw_example/Preloaded.v

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
Axiom test_axiom : False.
1+
Axiom test_axiom : False.
2+
Axiom another_axiom : False.

cw_example/Solution.v

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
Require Import Preloaded.
22

33
Lemma solution : 1 + 1 = 3.
4-
Proof. firstorder using test_axiom. Qed.
4+
Proof. firstorder using test_axiom. Qed.
5+
6+
Lemma solution2 : 1 + 1 = 3 /\ 2 + 2 = 4.
7+
Proof. split; [firstorder using test_axiom | firstorder using another_axiom]. Qed.

cw_example/SolutionTest.v

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ CWGroup "Tests for Solution.solution".
1212
(* CWEndTest is optional before CWTest or CWEndGroup *)
1313
CWEndTest.
1414
CWTest "Assumptions test".
15-
CWAssert "Testing solution" Solution.solution Assumes. (*test_axiom.*)
15+
CWAssert "Testing solution" Solution.solution Assumes test_axiom.
16+
CWAssert "Testing solution (failure)" Solution.solution Assumes. (*test_axiom.*)
17+
CWAssert "Testing solution2" Solution.solution2 Assumes test_axiom another_axiom.
18+
CWAssert "Testing solution2 (failure 1)" Solution.solution2 Assumes test_axiom.
19+
CWAssert "Testing solution2 (failure 2)" Solution.solution2 Assumes.
1620
CWTest "Type test 2".
1721
Definition expected := 1 + 1 = 3.
1822
CWAssert Solution.solution : expected.

src/coq_cw.ml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,20 @@ let test_axioms ?(msg = "Axiom Test") c_ref ax_refs =
109109
let ax_objs = List.map (fun c -> Printer.Axiom (Printer.Constant c, [])) ax_csts in
110110
let ax_set = Printer.ContextObjectSet.of_list ax_objs in
111111
let assums = assumptions c_ref in
112-
let iter t ty =
112+
let iter t ty axioms =
113113
match t with
114114
| Printer.Axiom (ax, _) ->
115-
if Printer.ContextObjectSet.mem t ax_set then ()
115+
if Printer.ContextObjectSet.mem t ax_set then axioms
116116
else begin
117117
let p_axiom = pr_axiom env sigma ax ty in
118-
failed (Printf.sprintf "%s\nProhibited Axiom: %s" msg (string_of_ppcmds p_axiom))
118+
string_of_ppcmds p_axiom :: axioms
119119
end
120-
| _ -> ()
120+
| _ -> axioms
121121
in
122-
let () = Printer.ContextObjectMap.iter iter assums in
123-
passed msg
122+
let axioms = Printer.ContextObjectMap.fold_left iter assums [] in
123+
match axioms with
124+
| [] -> passed msg
125+
| _ -> failed (Printf.sprintf "%s\nProhibited Axioms: %s" msg (String.concat "\n" axioms))
124126

125127
(** Tests that the file size is less than a given number *)
126128
let test_file_size ?(fname = solution_file) size =

0 commit comments

Comments
 (0)