Skip to content

Commit ea489db

Browse files
committed
Add some minimal tests
1 parent 4203ab1 commit ea489db

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

riscv/src/register/mstatus.rs

+16
Original file line numberDiff line numberDiff line change
@@ -593,3 +593,19 @@ pub unsafe fn set_mbe(endianness: Endianness) {
593593
},
594594
}
595595
}
596+
597+
#[cfg(test)]
598+
mod test {
599+
use super::*;
600+
601+
#[test]
602+
fn test_mpp() {
603+
let mut mstatus = Mstatus { bits: 0 };
604+
mstatus = mstatus.update_mpp(MPP::User);
605+
assert_eq!(mstatus.mpp(), MPP::User);
606+
mstatus = mstatus.update_mpp(MPP::Machine);
607+
assert_eq!(mstatus.mpp(), MPP::Machine);
608+
mstatus = mstatus.update_mpp(MPP::Supervisor);
609+
assert_eq!(mstatus.mpp(), MPP::Supervisor);
610+
}
611+
}

0 commit comments

Comments
 (0)