add tests, remove extraneous instructions.
This commit is contained in:
@@ -655,6 +655,7 @@ mod tests {
|
|||||||
assert_eq!(submit(&mut wam, "?- call(call(p), X, Y), call(call(call(p)), X, Y)."), true);
|
assert_eq!(submit(&mut wam, "?- call(call(p), X, Y), call(call(call(p)), X, Y)."), true);
|
||||||
assert_eq!(submit(&mut wam, "?- call(call(p), X, Y), call(call(call(p(X))), Y)."), true);
|
assert_eq!(submit(&mut wam, "?- call(call(p), X, Y), call(call(call(p(X))), Y)."), true);
|
||||||
assert_eq!(submit(&mut wam, "?- call(call(p), X, Y), call(call(call(p(X))), X, Y)."), false);
|
assert_eq!(submit(&mut wam, "?- call(call(p), X, Y), call(call(call(p(X))), X, Y)."), false);
|
||||||
|
assert_eq!(submit(&mut wam, "?- call(call(p), X, Y), call(call(call(p(X))), X)."), true);
|
||||||
|
|
||||||
submit(&mut wam, "f(call(f, undefined)). f(undefined).");
|
submit(&mut wam, "f(call(f, undefined)). f(undefined).");
|
||||||
submit(&mut wam, "call_var(P) :- P.");
|
submit(&mut wam, "call_var(P) :- P.");
|
||||||
|
|||||||
@@ -97,8 +97,7 @@ impl Index<CodePtr> for Machine {
|
|||||||
impl Machine {
|
impl Machine {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let mut code_dir = HashMap::new();
|
let mut code_dir = HashMap::new();
|
||||||
let code = vec![Line::BuiltIn(BuiltInInstruction::InternalCallN),
|
let code = vec![Line::BuiltIn(BuiltInInstruction::InternalCallN)];
|
||||||
Line::Control(ControlInstruction::Proceed)];
|
|
||||||
|
|
||||||
// there are 64 registers in the VM, so call/N is defined for all 0 <= N <= 63
|
// there are 64 registers in the VM, so call/N is defined for all 0 <= N <= 63
|
||||||
// (an extra register is needed for the predicate name)
|
// (an extra register is needed for the predicate name)
|
||||||
|
|||||||
Reference in New Issue
Block a user