Add more test cases to differentiate usage of discontiguous
This commit is contained in:
@@ -548,6 +548,14 @@ mod tests {
|
||||
),
|
||||
);
|
||||
|
||||
let query =
|
||||
String::from(r#"property_resolve(C, "isLiked"), subject_class("Todo", C)."#);
|
||||
let output = machine.run_query(query);
|
||||
assert_eq!(
|
||||
output,
|
||||
Ok(QueryResolution::False)
|
||||
);
|
||||
|
||||
let query =
|
||||
String::from(r#"subject_class("Todo", C), property_resolve(C, "isLiked")."#);
|
||||
let output = machine.run_query(query);
|
||||
@@ -556,4 +564,51 @@ mod tests {
|
||||
Ok(QueryResolution::False)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dont_return_partial_matches_without_discountiguous() {
|
||||
let mut machine = Machine::new_lib();
|
||||
|
||||
machine.consult_module_string(
|
||||
"facts",
|
||||
String::from(
|
||||
r#"
|
||||
a("true for a").
|
||||
b("true for b").
|
||||
"#,
|
||||
),
|
||||
);
|
||||
|
||||
let query =
|
||||
String::from(r#"a("true for a")."#);
|
||||
let output = machine.run_query(query);
|
||||
assert_eq!(
|
||||
output,
|
||||
Ok(QueryResolution::True)
|
||||
);
|
||||
|
||||
let query =
|
||||
String::from(r#"a("true for a"), b("true for b")."#);
|
||||
let output = machine.run_query(query);
|
||||
assert_eq!(
|
||||
output,
|
||||
Ok(QueryResolution::True)
|
||||
);
|
||||
|
||||
let query =
|
||||
String::from(r#"a("true for b"), b("true for b")."#);
|
||||
let output = machine.run_query(query);
|
||||
assert_eq!(
|
||||
output,
|
||||
Ok(QueryResolution::False)
|
||||
);
|
||||
|
||||
let query =
|
||||
String::from(r#"a("true for a"), b("true for a")."#);
|
||||
let output = machine.run_query(query);
|
||||
assert_eq!(
|
||||
output,
|
||||
Ok(QueryResolution::False)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user