aboutsummaryrefslogtreecommitdiff
path: root/tests/pathological.rs
diff options
context:
space:
mode:
authorIan McIntyre <me@mciantyre.dev>2025-04-12 18:37:30 -0400
committerIan McIntyre <me@mciantyre.dev>2025-09-28 10:32:16 -0400
commit495fbc58b6f4d2e751b16883a2c5cee3c598fd79 (patch)
tree733294d810dbd02dba79c156d47cdee246a88aec /tests/pathological.rs
parent7bf03005703186667623bfc681e10c44f7f8923d (diff)
Prototype a v0.2HEADv0.2
Needs to be documented. The gist: remove references to MMIO, and add support for nested structures. Drop the reset_reg! macro.
Diffstat (limited to 'tests/pathological.rs')
-rw-r--r--tests/pathological.rs70
1 files changed, 0 insertions, 70 deletions
diff --git a/tests/pathological.rs b/tests/pathological.rs
deleted file mode 100644
index d463e29..0000000
--- a/tests/pathological.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-//! Testing corner cases.
-
-#![allow(non_upper_case_globals, non_snake_case)] // Macro conventions.
-
-use ral_registers as ral;
-
-mod periph {
- #[repr(C)]
- pub struct RegisterBlock {
- /// Multi-dimensional arrays.
- #[allow(clippy::type_complexity)] // Intentionally complex type.
- pub DEEP_LEARNING: [[[[[[[[ral_registers::RWRegister<u32>; 1]; 2]; 3]; 4]; 5]; 6]; 7]; 8],
- }
-
- pub mod DEEP_LEARNING {
- pub mod GRADIENT {
- pub const offset: u32 = 3;
- pub const mask: u32 = 0x1F << offset;
- pub mod R {}
- pub mod W {}
- pub mod RW {}
- }
- }
-
- pub struct ResetValues {
- pub DEEP_LEARNING: u32,
- }
-
- pub mod INST {
- pub const reset: super::ResetValues = super::ResetValues { DEEP_LEARNING: 42 };
- }
-}
-
-fn register_block() -> periph::RegisterBlock {
- // Safety: bitpattern of zero is fine.
- use std::mem::MaybeUninit;
- unsafe { MaybeUninit::zeroed().assume_init() }
-}
-
-#[test]
-fn read_deep_array() {
- let rb = register_block();
- rb.DEEP_LEARNING[7][6][5][4][3][2][1][0].write(u32::MAX);
- let gradient = ral::read_reg!(periph, &rb, DEEP_LEARNING[7][6][5][4][3][2][1][0], GRADIENT);
- assert_eq!(gradient, 0x1F);
-}
-
-#[test]
-fn write_deep_array() {
- let rb = register_block();
- ral::write_reg!(periph, &rb, DEEP_LEARNING[7][6][5][4][3][2][1][0], 23);
- assert_eq!(rb.DEEP_LEARNING[7][6][5][4][3][2][1][0].read(), 23);
-}
-
-#[test]
-fn modify_deep_array() {
- let rb = register_block();
- ral::modify_reg!(periph, &rb, DEEP_LEARNING[7][6][5][4][3][2][1][0], GRADIENT: 42);
- assert_eq!(
- rb.DEEP_LEARNING[7][6][5][4][3][2][1][0].read(),
- (42 & 0x1F) << 3
- );
-}
-
-#[test]
-fn reset_deep_array() {
- let rb = register_block();
- ral::reset_reg!(periph, &rb, INST, DEEP_LEARNING[7][6][5][4][3][2][1][0]);
- assert_eq!(rb.DEEP_LEARNING[7][6][5][4][3][2][1][0].read(), 42);
-}