diff options
Diffstat (limited to 'grammar/src/tests')
-rw-r--r-- | grammar/src/tests/test_grammar_left_closure.rs | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/grammar/src/tests/test_grammar_left_closure.rs b/grammar/src/tests/test_grammar_left_closure.rs index ffc7c0f..be1df9d 100644 --- a/grammar/src/tests/test_grammar_left_closure.rs +++ b/grammar/src/tests/test_grammar_left_closure.rs @@ -82,59 +82,6 @@ fn test_nfa() -> Result<(), Box<dyn std::error::Error>> { } #[test] -fn test_remove_epsilon() -> Result<(), Box<dyn std::error::Error>> { - let mut lock = stdout().lock(); - - let mut grammar = new_paren_grammar()?; - - writeln!(lock, "grammar:")?; - writeln!(lock, "{grammar}")?; - - let closure = new_closure_regex(&mut grammar)?; - - let mut accumulator_value: usize = 0; - - for regex in closure.iter() { - writeln!( - lock, - "regex: {}", - regex.to_string_with(|tnt| { - match tnt { - TNT::Ter(t) => { - format!( - "({})", - grammar.name_of_tnt(grammar.unpack_tnt(t).unwrap()).unwrap() - ) - } - TNT::Non(_) => { - // hyper non-terminal - format!("({})", grammar.name_of_tnt(tnt).unwrap()) - } - } - })? - )?; - writeln!(lock, "regex len = {}", regex.nodes_len())?; - writeln!(lock, "offset = {accumulator_value}")?; - - accumulator_value += regex.nodes_len(); - } - - writeln!(lock, "total = {accumulator_value}")?; - - let mut nfa = grammar.left_closure_to_nfa(&closure)?; - - #[cfg(features = "test-print-viz")] - nfa.print_viz("nfa_orig.gv")?; - - nfa.remove_epsilon(|label| label.get_value().is_none())?; - - #[cfg(features = "test-print-viz")] - nfa.print_viz("nfa_no_epsilon.gv")?; - - Ok(()) -} - -#[test] fn test_remove_dead() -> Result<(), Box<dyn std::error::Error>> { let mut grammar = new_paren_grammar()?; let closure = new_closure_regex(&mut grammar)?; @@ -177,8 +124,6 @@ fn test_remove_dead() -> Result<(), Box<dyn std::error::Error>> { #[cfg(features = "test-print-viz")] nfa.print_viz("nfa_orig.gv")?; - // nfa.remove_epsilon(|label| label.get_value().is_none())?; - let accumulators: HashSet<usize> = accumulators.into_iter().collect(); println!("accumulators = {accumulators:?}"); |