use rstest::rstest;
use syster::parser::{AstNode, SourceFile, parse_kerml};
fn parses_kerml(input: &str) -> bool {
let parsed = parse_kerml(input);
SourceFile::cast(parsed.syntax()).is_some()
}
#[rstest]
#[case("namespace MyNamespace;")]
#[case("namespace MyNamespace {}")]
#[case("namespace <short> named {}")]
fn test_namespace(#[case] input: &str) {
assert!(parses_kerml(input), "Failed to parse: {}", input);
}
#[rstest]
#[case("package P { redefinition b.f redefines b.a; }")]
#[case("package P { redefinition a :>> b; }")]
fn test_redefinition(#[case] input: &str) {
assert!(parses_kerml(input), "Failed to parse: {}", input);
}
#[rstest]
#[case("package P { specialization id subtype A specializes B { } }")]
#[case("package P { specialization Super subclassifier A specializes B; }")]
fn test_specialization_relationship(#[case] input: &str) {
assert!(parses_kerml(input), "Failed to parse: {}", input);
}
#[rstest]
#[case("package P { subset laterOccurrence.successors subsets earlierOccurrence.successors; }")]
fn test_subset_relationship(#[case] input: &str) {
assert!(parses_kerml(input), "Failed to parse: {}", input);
}
#[rstest]
#[case("package P { disjoining disjoint A from B; }")]
fn test_disjoining(#[case] input: &str) {
assert!(parses_kerml(input), "Failed to parse: {}", input);
}
#[rstest]
#[case("package P { conjugation conj conjugate A conjugates B; }")]
fn test_conjugation(#[case] input: &str) {
assert!(parses_kerml(input), "Failed to parse: {}", input);
}
#[rstest]
#[case("package P { featuring feat of A by B; }")]
fn test_featuring(#[case] input: &str) {
assert!(parses_kerml(input), "Failed to parse: {}", input);
}
#[rstest]
#[case("package P { inverting inv inverse A inverses B; }")]
fn test_inverting(#[case] input: &str) {
assert!(parses_kerml(input), "Failed to parse: {}", input);
}