]>
Witch of Git - jade-mouse/blob - toolchain/src/cpu/test.rs
50573541a605782520fb8d7012cac7598f7f6487
2 use crate::inst
::{Inst
, Reg
};
3 use proptest
::prelude
::*;
5 fn cpu() -> impl Strategy
<Value
= Cpu
> {
9 prop
::collection
::vec(any
::<u8>(), 0..1024),
11 .prop_map(|(pc
, reg
, memory
)| Cpu
{
14 reg
: RegFile
{ values
: reg
},
19 fn reg() -> impl Strategy
<Value
= Reg
> {
20 (0..4).prop_map(|r
| match r
{
31 fn run_move(mut cpu
in cpu(), dst
in reg(), src
in reg()) {
32 let inst
= Inst
::Move(dst
, src
);
33 let val
= cpu
.reg(src
);
35 prop_assert_eq
!(val
, cpu
.reg(src
));
36 prop_assert_eq
!(val
, cpu
.reg(dst
));