Add testbench

This commit is contained in:
2025-08-25 12:09:54 +02:00
parent 42fa5affb5
commit f67c79c65b
2 changed files with 83 additions and 4 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ mod tests {
#[test]
fn test_replacements() {
let mut ruleset: crate::preprocessor::MetaRules =
crate::preprocessor::MetaRules::new("./language.toml");
crate::preprocessor::MetaRules::new("./testspecs.toml");
let sut: String = ruleset.process(String::from("-- Comment to remove"));
let verify: String = String::from("");
let case_comment_at_end: String =
@@ -18,7 +18,7 @@ mod tests {
#[test]
fn test_interpolation() {
let mut ruleset: crate::preprocessor::MetaRules =
crate::preprocessor::MetaRules::new("./language.toml");
crate::preprocessor::MetaRules::new("./testspecs.toml");
let run_with_interpolation_test: String = ruleset.process(String::from("#test"));
let interpolation_verification: String = std::fs::read_to_string("./mathlib.mlc").unwrap();
@@ -28,7 +28,7 @@ mod tests {
#[test]
fn test_meta_token() {
let mut ruleset: crate::preprocessor::MetaRules =
crate::preprocessor::MetaRules::new("./language.toml");
crate::preprocessor::MetaRules::new("./testspecs.toml");
let meta_token_test_string: String = ruleset.process(String::from("\"sample\""));
let meta_token_sample_string: String = String::from("\"sample\"");
let meta_token_verify: Vec<crate::tokenizer::Token> = vec![crate::tokenizer::Token {
@@ -47,7 +47,7 @@ mod tests {
#[test]
fn test_eat() {
let mut sample: crate::tokenizer::Tokenizer = crate::tokenizer::Tokenizer::new();
sample.read_configuration_from_file("./language.toml");
sample.read_configuration_from_file("./testspecs.toml");
sample.eat("faculty : Natural n := if n = 0 then 1 else n * faculty (n - 1);");
assert_eq!(