test: add busy beaver 2 unit test
This commit is contained in:
1 parent
fddc6b8524
commit
d68346c241
1 file changed
+25
+25
@@ -22,3 +22,28 @@ impl Display for TuringMachineError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn busy_beaver_2() {
|
||||||
|
let mut machine = TuringMachine::with_state_entries(
|
||||||
|
[
|
||||||
|
"A|0|1;R;B",
|
||||||
|
"A|1|1;L;C",
|
||||||
|
"B|0|1;L;A",
|
||||||
|
"B|1|1;R;B",
|
||||||
|
"C|0|1;L;B",
|
||||||
|
"C|1|1;R;-HALT-",
|
||||||
|
]
|
||||||
|
.into_iter(),
|
||||||
|
"A",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
while let NextState::State(_) = machine.step() {}
|
||||||
|
assert_eq!(machine.peek(4).to_string(), " 1 1 1 1 [1] 1 0 0 ");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user