Adds tools to test struct

This commit is contained in:
Dandaedre 2024-04-10 21:00:52 +02:00
parent 25c1b11538
commit e4d0b26425
1 changed files with 44 additions and 0 deletions

View File

@ -238,6 +238,50 @@ mod test {
#[test]
fn test_listid() {}
#[derive(Debug)]
struct BareNode {
list: Option<Vec<BareNode>>,
level: SkillTypes,
}
impl BareNode {
fn new(level: SkillTypes, list_lower: Option<Vec<BareNode>>) -> Self {
Self {
list: list_lower,
level,
}
}
fn new_end(level: SkillTypes) -> BareNode {
Self { list: None, level }
}
}
macro_rules! ends {
($($a:ident),+) => {
vec![$(BareNode::new_end(SkillTypes::$a),)+]
};
}
macro_rules! a {
($a:ident, $b:expr) => {
BareNode::new(SkillTypes::$a, Some($b))
};
}
macro_rules! l {
($($b:ident)+) => {
vec![$($b),+]
};
}
#[test]
fn test_end() {
// let end1 = ;
let node = a!(Skill, ends!(NewLine, RepeatingSkills, RepeatingItem));
let node = a!(SubSection, l!(node));
let node = a!(Section, l!(node));
println!("{:?}", node);
assert!(false);
}
#[test]
fn test_edge_cases() {
let line_id = ListId::from_string("\n".to_string()).unwrap();