Skip to content

Commit 783906a

Browse files
committed
riscv: use CSR test macro for invalid mcounteren
Uses the CSR test helper macro for invalid `mcounteren` range field values.
1 parent 9f0cb19 commit 783906a

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

Diff for: riscv/src/register/mcounteren.rs

+8-14
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,16 @@ mod tests {
120120
(3..32).for_each(|i| test_csr_field!(m, hpm, i));
121121

122122
(0..3).chain(32..64).for_each(|index| {
123-
assert_eq!(
124-
m.try_hpm(index),
125-
Err(Error::IndexOutOfBounds {
123+
test_csr_field!(
124+
m,
125+
hpm,
126+
index,
127+
Error::IndexOutOfBounds {
126128
index,
127129
min: 3,
128130
max: 31
129-
})
130-
);
131-
assert_eq!(
132-
m.try_set_hpm(index, false),
133-
Err(Error::IndexOutOfBounds {
134-
index,
135-
min: 3,
136-
max: 31
137-
})
138-
);
139-
})
131+
}
132+
)
133+
});
140134
}
141135
}

0 commit comments

Comments
 (0)