You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
971 B

#[allow(unused_imports)]
use stackline::prelude::*;
use stackline::signal;
mod common;
#[test]
fn test_reader() {
let mut world = load_test!("tests/storage/reader.json");
world.init();
world.set_signal((0, 0), signal!(Direction::Down, [0]));
run!(world, 5);
assert_stored!(world, 0, 1, signal!([0]));
assert_no_stored!(world, 2, 0);
world.set_signal((1, 2), signal!(Direction::Up, [-1]));
run!(world, 5);
assert_stored!(world, 2, 0, signal!([0]));
world.set_signal((0, 0), signal!(Direction::Down, [1]));
run!(world, 5);
assert_stored!(world, 0, 1, signal!([1]));
assert_stored!(world, 2, 0, signal!([0]));
}
#[test]
fn test_counter() {
let mut world = load_test!("tests/storage/counter.json");
world.init();
for n in 1..10 {
world.set_signal((1, 3), signal!(Direction::Up));
println!("{}", world);
run!(world, 11);
assert_stored!(world, 0, 2, signal!([n]));
}
}