MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / decode_add

Function decode_add

crates/virtual-machine/tests/vm_decoder.rs:51–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49
50#[test]
51fn decode_add() {
52 let encoded = Add::new(3, 1, 2).encode();
53 let decoded = decode(encoded).expect("should decode ADD");
54 if let DecodedInsn::Alu {
55 rd,
56 rs1,
57 rs2,
58 funct3,
59 funct7,
60 } = decoded
61 {
62 assert_eq!(rd, 3);
63 assert_eq!(rs1, 1);
64 assert_eq!(rs2, 2);
65 assert_eq!(funct3, 0);
66 assert_eq!(funct7, 0);
67 } else {
68 panic!("expected DecodedInsn::Alu, got {decoded:?}");
69 }
70}
71
72#[test]
73fn decode_sub() {

Callers

nothing calls this directly

Calls 2

decodeFunction · 0.50
encodeMethod · 0.45

Tested by

no test coverage detected