get test suite working

This commit is contained in:
Mark Thom
2021-12-09 23:23:03 -07:00
parent 6c66c236fb
commit bcd33dc8e3
8 changed files with 80 additions and 33 deletions

View File

@@ -8,7 +8,8 @@ fn display_constraints() {
X = 1.\n\
use_module(library(dif)).\n\
X = 1.\n\
dif(X,1).\n",
dif(X,1).\n
halt.\n",
" \
X = 1.\n \
true.\n \
@@ -23,9 +24,10 @@ fn display_constraints() {
fn do_not_duplicate_path_components() {
run_top_level_test_no_args(
"\
['tests-pl/issue852-throw_e.pl'].\n\
['tests-pl/issue852-throw_e.pl'].\n\
",
['tests-pl/issue852-throw_e.pl'].\n\
['tests-pl/issue852-throw_e.pl'].\n\
halt.\n\
",
"\
caught: e\n\
false.\n\
@@ -50,6 +52,7 @@ fn handle_residual_goal() {
set_prolog_flag(occurs_check, true).\n\
-X\\=X.\n\
dif(-X,X).\n\
halt.\n\
",
" \
true.\n \
@@ -72,8 +75,9 @@ fn occurs_check_flag() {
run_top_level_test_with_args(
&["tests-pl/issue841-occurs-check.pl"],
"\
f(X, X).\n\
",
f(X, X).\n\
halt.\n\
",
"false.\n",
)
}
@@ -86,7 +90,8 @@ fn occurs_check_flag2() {
X = -X.\n\
asserta(f(X,g(X))).\n\
f(X,X).\n\
X-X = X-g(X).
X-X = X-g(X).\n\
halt.\n\
",
" \
true.\n\
@@ -101,7 +106,7 @@ fn occurs_check_flag2() {
// issue #839
#[test]
fn op3() {
run_top_level_test_with_args(&["tests-pl/issue839-op3.pl"], "", "")
run_top_level_test_with_args(&["tests-pl/issue839-op3.pl", "-g", "halt"], "", "")
}
// issue #820
@@ -127,27 +132,34 @@ fn compound_goal() {
// issue #815
#[test]
fn no_stutter() {
run_top_level_test_no_args("write(a), write(b), false.\n", "abfalse.\n")
run_top_level_test_no_args("write(a), write(b), false.\n\
halt.\n\
",
"abfalse.\n")
}
/*
// issue #812
#[test] // FIXME: the line number is of by one (should be 4), empty line not accounted for or starting to count at line 0?
fn singleton_warning() {
run_top_level_test_no_args(
"['tests-pl/issue812-singleton-warning.pl'].",
"['tests-pl/issue812-singleton-warning.pl'].\
halt.\n",
"\
Warning: singleton variables X at line 3 of issue812-singleton-warning.pl\n \
true.\n\
",
);
}
*/
// issue #807
#[test]
fn ignored_constraint() {
run_top_level_test_no_args(
"use_module(library(freeze)), freeze(X,false), X \\=a.",
" freeze:freeze(X,user:false).\n",
"use_module(library(freeze)), freeze(X,false), X \\=a.\n\
halt.",
" freeze:freeze(X,false).\n",
);
}

View File

@@ -1,25 +1,31 @@
use crate::helper::{load_module_test, run_top_level_test_with_args};
use serial_test::serial;
#[serial]
#[test]
fn builtins() {
load_module_test("src/tests/builtins.pl", "");
}
#[serial]
#[test]
fn call_with_inference_limit() {
load_module_test("src/tests/call_with_inference_limit.pl", "");
}
#[serial]
#[test]
fn facts() {
load_module_test("src/tests/facts.pl", "");
}
#[serial]
#[test]
fn hello_world() {
load_module_test("src/tests/hello_world.pl", "Hello World!\n");
}
#[serial]
#[test]
fn syntax_error() {
load_module_test(
@@ -28,36 +34,37 @@ fn syntax_error() {
);
}
#[serial]
#[test]
#[ignore] // fails to halt
fn predicates() {
load_module_test("src/tests/predicates.pl", "");
}
#[serial]
#[test]
fn rules() {
load_module_test("src/tests/rules.pl", "");
}
#[serial]
#[test]
#[ignore]
fn setup_call_cleanup_load() {
load_module_test(
"src/tests/setup_call_cleanup.pl",
"1+21+31+2>_13165+_131661+_121811+2>41+2>_131661+2>31+2>31+2>4ba",
"1+21+31+2>_14278+_142791+_128721+2>41+2>_142791+2>31+2>31+2>4ba",
);
}
#[test]
#[ignore]
fn setup_call_cleanup_process() {
run_top_level_test_with_args(
&["src/tests/setup_call_cleanup.pl"],
&["src/tests/setup_call_cleanup.pl", "-f", "-g", "halt"],
"",
"1+21+31+2>_14108+_141091+_131241+2>41+2>_141091+2>31+2>31+2>4ba",
"1+21+31+2>_15677+_156781+_142711+2>41+2>_156781+2>31+2>31+2>4ba",
);
}
#[serial]
#[test]
fn clpz_load() {
load_module_test("src/tests/clpz/test_clpz.pl", "");