update tests to properly reflect answer order.

This commit is contained in:
Mark Thom
2018-01-20 15:08:55 -07:00
parent 03c96d45b3
commit 677beedec3
9 changed files with 592 additions and 578 deletions

View File

@@ -300,7 +300,7 @@ pub enum Term {
}
pub enum InlinedQueryTerm {
CompareNumber(CompareNumberQT, Vec<Box<Term>>),
CompareNumber(CompareNumberQT, Vec<Box<Term>>),
IsAtomic(Vec<Box<Term>>),
IsVar(Vec<Box<Term>>),
IsInteger(Vec<Box<Term>>)
@@ -309,7 +309,7 @@ pub enum InlinedQueryTerm {
impl InlinedQueryTerm {
pub fn arity(&self) -> usize {
match self {
&InlinedQueryTerm::CompareNumber(_, _) => 2,
&InlinedQueryTerm::CompareNumber(_, _) => 2,
&InlinedQueryTerm::IsAtomic(_) => 1,
&InlinedQueryTerm::IsInteger(_) => 1,
&InlinedQueryTerm::IsVar(_) => 1,
@@ -346,8 +346,8 @@ impl QueryTerm {
match self {
&QueryTerm::Arg(_) => 3,
&QueryTerm::Catch(_) => 3,
&QueryTerm::Throw(_) => 1,
&QueryTerm::Display(_) => 1,
&QueryTerm::Throw(_) => 1,
&QueryTerm::DuplicateTerm(_) => 2,
&QueryTerm::Functor(_) => 3,
&QueryTerm::Inlined(ref term) => term.arity(),
@@ -384,8 +384,8 @@ impl<'a> ClauseType<'a> {
&ClauseType::Arg => "arg",
&ClauseType::CallN => "call",
&ClauseType::Catch => "catch",
&ClauseType::Deep(_, _, name, _) => name.as_str(),
&ClauseType::Display => "display",
&ClauseType::Deep(_, _, name, _) => name.as_str(),
&ClauseType::DuplicateTerm => "duplicate_term",
&ClauseType::Functor => "functor",
&ClauseType::Is => "is",
@@ -735,7 +735,7 @@ pub enum ArithmeticInstruction {
pub enum BuiltInInstruction {
CleanUpBlock,
CompareNumber(CompareNumberQT, ArithmeticTerm, ArithmeticTerm),
CompareNumber(CompareNumberQT, ArithmeticTerm, ArithmeticTerm),
EraseBall,
Fail,
GetArg,
@@ -765,9 +765,9 @@ pub enum ControlInstruction {
CallN(usize), // arity.
CatchCall,
CatchExecute,
Deallocate,
DisplayCall,
DisplayExecute,
Deallocate,
DuplicateTermCall,
DuplicateTermExecute,
Execute(TabledRc<Atom>, usize),

View File

@@ -578,12 +578,8 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<'a, TermMarker>
code
}
fn compile_query_line(&mut self,
term: &'a QueryTerm,
term_loc: GenContext,
code: &mut Code,
index: usize,
is_exposed: bool)
fn compile_query_line(&mut self, term: &'a QueryTerm, term_loc: GenContext,
code: &mut Code, index: usize, is_exposed: bool)
{
self.marker.reset_arg(term.arity());

View File

@@ -92,7 +92,7 @@ impl<'a> VariableFixtures<'a>
// 1. move the use sets of each variable to a local HashMap, use_set
// (iterate mutably, swap mutable refs).
// 2. drain use_set. For each use set of U, add into the
// no-use sets of appropriate variables T /= U.
// no-use sets of appropriate variables T =/= U.
// 3. Move the use sets back to their original locations in the fixture.
// Compute the conflict set of u.

View File

@@ -112,9 +112,9 @@ impl fmt::Display for ControlInstruction {
&ControlInstruction::CatchExecute =>
write!(f, "execute_catch"),
&ControlInstruction::DisplayCall =>
write!(f, "call_display"),
write!(f, "display_call"),
&ControlInstruction::DisplayExecute =>
write!(f, "execute_display"),
write!(f, "display_execute"),
&ControlInstruction::DuplicateTermCall =>
write!(f, "call_duplicate_term"),
&ControlInstruction::DuplicateTermExecute =>
@@ -164,7 +164,7 @@ impl fmt::Display for BuiltInInstruction {
&BuiltInInstruction::CleanUpBlock =>
write!(f, "clean_up_block"),
&BuiltInInstruction::CompareNumber(cmp, ref at_1, ref at_2) =>
write!(f, "number_test {}, {}, {} ", cmp, at_1, at_2),
write!(f, "number_test {}, {}, {} ", cmp, at_1, at_2),
&BuiltInInstruction::DynamicCompareNumber(cmp) =>
write!(f, "dynamic_number_test {}", cmp),
&BuiltInInstruction::EraseBall =>

View File

@@ -39,11 +39,7 @@ impl<'a> QueryIterator<'a> {
&QueryTerm::Catch(ref terms) => {
let state = TermIterState::Clause(0, ClauseType::Catch, terms);
QueryIterator { state_stack: vec![state] }
},
&QueryTerm::Display(ref terms) => {
let state = TermIterState::Clause(0, ClauseType::Display, terms);
QueryIterator { state_stack: vec![state] }
},
},
&QueryTerm::DuplicateTerm(ref terms) => {
let state = TermIterState::Clause(0, ClauseType::DuplicateTerm, terms);
QueryIterator { state_stack: vec![state] }
@@ -56,11 +52,15 @@ impl<'a> QueryIterator<'a> {
let state = TermIterState::Clause(0, ClauseType::Functor, terms);
QueryIterator { state_stack: vec![state] }
},
&QueryTerm::Display(ref terms) => {
let state = TermIterState::Clause(0, ClauseType::Display, terms);
QueryIterator { state_stack: vec![state] }
},
&QueryTerm::Inlined(InlinedQueryTerm::CompareNumber(_, ref terms))
| &QueryTerm::Is(ref terms) => {
let state = TermIterState::Clause(0, ClauseType::Is, terms);
QueryIterator { state_stack: vec![state] }
},
},
&QueryTerm::Inlined(InlinedQueryTerm::IsAtomic(ref terms))
| &QueryTerm::Inlined(InlinedQueryTerm::IsInteger(ref terms))
| &QueryTerm::Inlined(InlinedQueryTerm::IsVar(ref terms)) =>