Skip to content

Commit

Permalink
riscv: use CSR test macro for invalid mcounteren
Browse files Browse the repository at this point in the history
Uses the CSR test helper macro for invalid `mcounteren` range field
values.
  • Loading branch information
rmsyn committed Nov 2, 2024
1 parent 9f0cb19 commit 783906a
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions riscv/src/register/mcounteren.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,16 @@ mod tests {
(3..32).for_each(|i| test_csr_field!(m, hpm, i));

(0..3).chain(32..64).for_each(|index| {
assert_eq!(
m.try_hpm(index),
Err(Error::IndexOutOfBounds {
test_csr_field!(
m,
hpm,
index,
Error::IndexOutOfBounds {
index,
min: 3,
max: 31
})
);
assert_eq!(
m.try_set_hpm(index, false),
Err(Error::IndexOutOfBounds {
index,
min: 3,
max: 31
})
);
})
}
)
});
}
}

0 comments on commit 783906a

Please sign in to comment.