add structural tests for partial strings, rename ast.rs
This commit is contained in:
6
Cargo.lock
generated
6
Cargo.lock
generated
@@ -86,7 +86,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prolog_parser"
|
||||
version = "0.7.9"
|
||||
version = "0.7.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ordered-float 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -112,7 +113,7 @@ dependencies = [
|
||||
"downcast 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ordered-float 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"prolog_parser 0.7.9",
|
||||
"prolog_parser 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -151,6 +152,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
"checksum num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070"
|
||||
"checksum num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "630de1ef5cc79d0cdd78b7e33b81f083cbfe90de0f4b2b2f07f905867c70e9fe"
|
||||
"checksum ordered-float 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "58d25b6c0e47b20d05226d288ff434940296e7e2f8b877975da32f862152241f"
|
||||
"checksum prolog_parser 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "277adc8aef82e87336a642a9bbd480cac9550e5ec63c99465eed7cbc7c165808"
|
||||
"checksum redox_syscall 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "ab105df655884ede59d45b7070c8a65002d921461ee813a024558ca16030eea0"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#[macro_use] extern crate prolog_parser;
|
||||
extern crate termion;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
|
||||
mod prolog;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::fixtures::*;
|
||||
use prolog::targets::*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::vec::Vec;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use std::cell::Cell;
|
||||
use std::cmp::{min, max};
|
||||
use std::rc::Rc;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::allocator::*;
|
||||
use prolog::arithmetic::*;
|
||||
use prolog::fixtures::*;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::debray_allocator::*;
|
||||
use prolog::codegen::*;
|
||||
use prolog::machine::*;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use prolog::ast::*;
|
||||
use prolog::and_stack::*;
|
||||
use prolog::instructions::*;
|
||||
|
||||
use std::ops::IndexMut;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::allocator::*;
|
||||
use prolog::targets::*;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::instructions::*;
|
||||
use prolog::iterators::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use std::cell::Cell;
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use std::collections::btree_map::{IntoIter, IterMut, Values};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::machine::machine_state::*;
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::machine::machine_state::*;
|
||||
use prolog::num::*;
|
||||
use prolog::heap_iter::*;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::hash::Hash;
|
||||
use std::rc::Rc;
|
||||
@@ -217,7 +217,6 @@ impl CodeOffsets {
|
||||
IntIndex::Internal(_) => prelude_len - lst_offset + 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn add_indices(self, code: &mut Code, mut code_body: Code)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::heap_print::*;
|
||||
use prolog::machine::*;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use std::cell::Cell;
|
||||
use std::collections::VecDeque;
|
||||
use std::iter::*;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::machine::machine_state::*;
|
||||
use prolog::num::bigint::BigInt;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use prolog_parser::ast::*;
|
||||
use prolog_parser::tabled_rc::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::and_stack::*;
|
||||
use prolog::copier::*;
|
||||
use prolog::heap_print::*;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use prolog_parser::ast::*;
|
||||
use prolog_parser::string_list::StringList;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::and_stack::*;
|
||||
use prolog::copier::*;
|
||||
use prolog::heap_iter::*;
|
||||
@@ -1528,10 +1528,22 @@ impl MachineState {
|
||||
return Ordering::Greater,
|
||||
(HeapCellValue::Addr(Addr::Con(Constant::String(_))),
|
||||
HeapCellValue::Addr(Addr::Con(Constant::Number(_)))) =>
|
||||
return Ordering::Greater,
|
||||
return Ordering::Greater,
|
||||
(HeapCellValue::Addr(Addr::Con(Constant::String(s1))),
|
||||
HeapCellValue::Addr(Addr::Con(Constant::String(s2)))) =>
|
||||
return s1.cmp(&s2),
|
||||
return if s1.is_expandable() {
|
||||
if s2.is_expandable() {
|
||||
s1.cmp(&s2)
|
||||
} else {
|
||||
Ordering::Greater
|
||||
}
|
||||
} else {
|
||||
if s2.is_expandable() {
|
||||
Ordering::Less
|
||||
} else {
|
||||
s1.cmp(&s2)
|
||||
}
|
||||
},
|
||||
(HeapCellValue::Addr(Addr::Con(Constant::String(_))), _) =>
|
||||
return Ordering::Less,
|
||||
(HeapCellValue::Addr(Addr::Con(Constant::Atom(..))),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use prolog_parser::ast::*;
|
||||
use prolog_parser::tabled_rc::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::compile::*;
|
||||
use prolog::heap_print::*;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::machine::machine_errors::*;
|
||||
use prolog::machine::machine_state::*;
|
||||
use prolog::num::{ToPrimitive, Zero};
|
||||
|
||||
@@ -2,7 +2,7 @@ extern crate num;
|
||||
extern crate ordered_float;
|
||||
extern crate prolog_parser;
|
||||
|
||||
#[macro_use] pub mod ast;
|
||||
#[macro_use] pub mod instructions;
|
||||
pub mod and_stack;
|
||||
#[macro_use] pub mod macros;
|
||||
#[macro_use] pub mod allocator;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::vec::Vec;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use prolog_parser::ast::*;
|
||||
use prolog_parser::parser::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::iterators::*;
|
||||
use prolog::machine::machine_state::*;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::iterators::*;
|
||||
|
||||
pub trait CompilationTarget<'a> {
|
||||
|
||||
@@ -2,7 +2,7 @@ use prolog_parser::ast::*;
|
||||
use prolog_parser::parser::*;
|
||||
use prolog_parser::tabled_rc::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::iterators::*;
|
||||
use prolog::machine::*;
|
||||
use prolog::num::*;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use prolog_parser::ast::*;
|
||||
|
||||
use prolog::ast::*;
|
||||
use prolog::heap_print::*;
|
||||
use prolog::instructions::*;
|
||||
use prolog::compile::*;
|
||||
use prolog::machine::*;
|
||||
|
||||
@@ -1936,4 +1936,7 @@ fn test_queries_on_string_lists()
|
||||
assert_prolog_failure!(&mut wam, "?- partial_string(\"abc\", X), partial_string(\"ababc\", Y), Y = [a,b|Z],
|
||||
X == Z.");
|
||||
|
||||
assert_prolog_success!(&mut wam, "?- partial_string(\"abc\", X), X @> \"abc\".");
|
||||
assert_prolog_failure!(&mut wam, "?- partial_string(\"abc\", X), X \\=@= \"abc\".");
|
||||
assert_prolog_failure!(&mut wam, "?- partial_string(\"abc\", X), X @< \"abc\".");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user