This commit is contained in:
2026-01-27 12:00:34 +01:00
parent 5456c9414a
commit 324d1feda1
17 changed files with 277 additions and 833 deletions

View File

@@ -1,6 +1,6 @@
use rand::rngs::StdRng;
use rand::SeedableRng;
use cagire::forth::{Dictionary, EmissionCounter, Forth, Rng, StepContext, Value, Variables};
use cagire::forth::{Dictionary, Forth, Rng, StepContext, Value, Variables};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
@@ -46,14 +46,6 @@ pub fn forth_seeded(seed: u64) -> Forth {
Forth::new(new_vars(), new_dict(), seeded_rng(seed))
}
pub fn new_emission_counter() -> EmissionCounter {
Arc::new(Mutex::new(0))
}
pub fn forth_with_counter(counter: EmissionCounter) -> Forth {
Forth::new_with_counter(new_vars(), new_dict(), seeded_rng(42), counter)
}
pub fn run(script: &str) -> Forth {
let f = forth();
f.evaluate(script, &default_ctx()).unwrap();
@@ -139,13 +131,3 @@ pub fn expect_outputs(script: &str, count: usize) -> Vec<String> {
outputs
}
#[allow(dead_code)]
pub fn expect_output_contains(script: &str, substr: &str) {
let outputs = expect_outputs(script, 1);
assert!(
outputs[0].contains(substr),
"output '{}' does not contain '{}'",
outputs[0],
substr
);
}