add more complex normalization test & fix normalization of application arguments

This commit is contained in:
Michael Sippel 2023-10-02 18:57:49 +02:00
parent 7b22bdc170
commit 3014213aa7
Signed by: senvas
GPG key ID: F96CF119C34B64A6
2 changed files with 11 additions and 1 deletions

View file

@ -41,7 +41,7 @@ impl TypeTerm {
new_ladder.push( TypeTerm::App(vec![]) );
for arg in args_iter {
match arg.clone() {
match arg.normalize() {
TypeTerm::Ladder(rungs) => {
// duplicate last element for each rung
let l = new_ladder.len();

View file

@ -43,5 +43,15 @@ fn test_normalize() {
dict.parse("<Seq <Digit 10>~Char>").expect("parse error").normalize(),
dict.parse("<Seq <Digit 10>>~<Seq Char>").expect("parse errror"),
);
assert_eq!(
dict.parse("<A <B C~D~E> F~G H H>").expect("parse error").normalize(),
dict.parse("<A <B C> F H H>
~<A <B D> F H H>
~<A <B E> F H H>
~<A <B E> G H H>").expect("parse errror"),
);
}