fix tests
This commit is contained in:
parent
2f935ea3c2
commit
de739a6e1a
2 changed files with 7 additions and 8 deletions
src
|
@ -17,7 +17,7 @@ use {
|
|||
pub struct SteinerTree {
|
||||
weight: u64,
|
||||
goals: Vec< TypeTerm >,
|
||||
edges: Vec< MorphismType >,
|
||||
pub edges: Vec< MorphismType >,
|
||||
}
|
||||
|
||||
impl SteinerTree {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use {
|
||||
crate::{dict::*, morphism::*, steiner_tree::*, TypeTerm}
|
||||
crate::{dict::*, parser::*, unparser::*, morphism::*, steiner_tree::*, TypeTerm}
|
||||
};
|
||||
|
||||
//<<<<>>>><<>><><<>><<<*>>><<>><><<>><<<<>>>>\\
|
||||
|
@ -27,8 +27,8 @@ impl Morphism for DummyMorphism {
|
|||
}
|
||||
}
|
||||
|
||||
fn morphism_test_setup() -> ( TypeDict, MorphismBase<DummyMorphism> ) {
|
||||
let mut dict = TypeDict::new();
|
||||
fn morphism_test_setup() -> ( BimapTypeDict, MorphismBase<DummyMorphism> ) {
|
||||
let mut dict = BimapTypeDict::new();
|
||||
let mut base = MorphismBase::<DummyMorphism>::new( dict.add_typename("Seq".into()) );
|
||||
|
||||
dict.add_varname("Radix".into());
|
||||
|
@ -118,7 +118,7 @@ fn test_morphism_path() {
|
|||
Some((
|
||||
DummyMorphism(MorphismType{
|
||||
src_type: dict.parse("<Seq <Digit Radix> ~ Char>").unwrap(),
|
||||
dst_type: dict.parse("<Seq <Digit Radix> ~ ℤ_2^64 ~ machine.UInt64>").unwrap()
|
||||
dst_type: dict.parse("<Seq <Digit Radix> ~ ℤ_2^64 ~ machine.UInt64>").unwrap()
|
||||
}),
|
||||
|
||||
dict.parse("Symbol ~ ℕ ~ <PosInt 10 BigEndian> ~ <Seq <Digit 10>>").unwrap(),
|
||||
|
@ -145,12 +145,12 @@ fn test_steiner_tree() {
|
|||
// destination reprs
|
||||
vec![
|
||||
dict.parse("ℕ ~ <PosInt 2 BigEndian> ~ <Seq <Digit 2> ~ Char>").unwrap(),
|
||||
dict.parse("ℕ ~ <PosInt 10 LittleEndian> ~ <Seq <Digit 10> ~ Char>").unwrap(),
|
||||
dict.parse("ℕ ~ <PosInt 10 LittleEndian> ~ <Seq <Digit 10> ~ Char>").unwrap(),
|
||||
dict.parse("ℕ ~ <PosInt 16 LittleEndian> ~ <Seq <Digit 16> ~ Char>").unwrap()
|
||||
]
|
||||
);
|
||||
|
||||
if let Some(solution) = steiner_tree_problem.solve_bfs( &dict, &base ) {
|
||||
if let Some(solution) = steiner_tree_problem.solve_bfs( &base ) {
|
||||
for e in solution.edges.iter() {
|
||||
eprintln!(" :: {}\n--> {}", dict.unparse(&e.src_type), dict.unparse(&e.dst_type));
|
||||
}
|
||||
|
@ -158,4 +158,3 @@ fn test_steiner_tree() {
|
|||
eprintln!("no solution");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue