]> Repositorios git - scryer-prolog.git/commitdiff
Run dif tests on cargo test
authorbakaq <[email protected]>
Thu, 21 Sep 2023 15:14:27 +0000 (12:14 -0300)
committerbakaq <[email protected]>
Thu, 21 Sep 2023 15:14:27 +0000 (12:14 -0300)
src/tests/dif.pl [moved from tests-pl/dif_tests.pl with 91% similarity]
tests/scryer/src_tests.rs

similarity index 91%
rename from tests-pl/dif_tests.pl
rename to src/tests/dif.pl
index 01ece5fa4af2e4ea1db54fd9f0d3bfb78685b0a2..752458b558b2fa388a4f63b13728f5fa401b5162 100644 (file)
@@ -195,6 +195,15 @@ main :-
     show_failed(Failed),
     halt.
 
+main_quiet :-
+    findall(test(Name, Goal), test(Name, Goal), Tests),
+    run_tests_quiet(Tests, Failed),
+    (   Failed = [] ->
+        format("All tests passed", [])
+    ;   format("Some tests failed", [])
+    ),
+    halt.
+
 portray_failed_([]) --> [].
 portray_failed_([F|Fs]) -->
     "\"", F, "\"",  "\n", portray_failed_(Fs).
@@ -217,6 +226,14 @@ run_tests([test(Name, Goal)|Tests], Failed) :-
     ),
     run_tests(Tests, Failed1).
 
+run_tests_quiet([], []).
+run_tests_quiet([test(Name, Goal)|Tests], Failed) :-
+    (   call(Goal) ->
+        Failed = Failed1
+    ;   Failed = [Name|Failed1]
+    ),
+    run_tests_quiet(Tests, Failed1).
+
 assert_p(A, B) :-
     phrase(portray_clause_(A), Portrayed),
     phrase((B, ".\n"), Portrayed).
index f913788ea3c7365b03527ee3865860357b9ec74e..5572b75f450ba5ba8eaaf488d80f5b97c325b13a 100644 (file)
@@ -75,3 +75,12 @@ fn clpz_load() {
 fn iso_conformity_tests() {
     load_module_test("tests-pl/iso-conformity-tests.pl", "All tests passed");
 }
+
+#[test]
+fn dif_tests() {
+    run_top_level_test_with_args(
+        &["src/tests/dif.pl", "-f", "-g", "main_quiet"],
+        "",
+        "All tests passed",
+    );
+}