modify structural_eq_test

This commit is contained in:
Mark Thom
2018-08-26 02:03:16 -06:00
parent 9759c523b6
commit 5afa4a7848

View File

@@ -338,6 +338,14 @@ impl MachineState {
self.and_stack[fr][sc] = Addr::Con(c.clone()); self.and_stack[fr][sc] = Addr::Con(c.clone());
self.trail(Ref::StackCell(fr, sc)); self.trail(Ref::StackCell(fr, sc));
}, },
Addr::Con(Constant::String(s)) =>
self.fail = match c {
Constant::EmptyList
if self.flags.double_quotes.is_chars() =>
!s.is_empty(),
Constant::String(s2) => s != s2,
_ => true
},
Addr::Con(c1) => { Addr::Con(c1) => {
if c1 != c { if c1 != c {
self.fail = true; self.fail = true;
@@ -1771,18 +1779,6 @@ impl MachineState {
if self.flags.double_quotes.is_chars() => if !s.is_empty() { if self.flags.double_quotes.is_chars() => if !s.is_empty() {
return true; return true;
}, },
(HeapCellValue::Addr(Addr::Con(Constant::Atom(atom))),
HeapCellValue::Addr(Addr::Con(Constant::Char(c))))
| (HeapCellValue::Addr(Addr::Con(Constant::Char(c))),
HeapCellValue::Addr(Addr::Con(Constant::Atom(atom)))) => {
if atom.as_str().chars().count() == 1 {
if Some(c) == atom.as_str().chars().next() {
continue;
}
}
return true;
},
(HeapCellValue::NamedStr(ar1, n1, _), HeapCellValue::NamedStr(ar2, n2, _)) => (HeapCellValue::NamedStr(ar1, n1, _), HeapCellValue::NamedStr(ar2, n2, _)) =>
if ar1 != ar2 || n1 != n2 { if ar1 != ar2 || n1 != n2 {
return true; return true;