looklook 0.9.0

Descriptive signal synthesiser.
// Copyright 2026 Gabriel Bjørnager Jensen.
//
// This file is part of LOOKLOOK.
//
// LOOKLOOK is free software: you can redistribute it and/or modify it under the
// terms of the GNU Affero General Public License as published by the Free Software
// Foundation, either version 3 of the License, or (at your option) any later ver-
// sion.
//
// LOOKLOOK is distributed in the hope that it will be useful, but WITHOUT ANY WAR-
// RANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
// PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License along
// with LOOKLOOK. If not, see <https://www.gnu.org/licenses/>.

//! Tests for [`Segment`].

#![cfg(test)]

use crate::isa::Long;
use crate::vm::Segment;

#[test]
fn test_segment_from_addr() {
	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x000000)),
		Segment::IMG0,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x100000)),
		Segment::IMG1,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x200000)),
		Segment::IMG2,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x300000)),
		Segment::IMG3,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x400000)),
		Segment::IMG4,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x500000)),
		Segment::IMG5,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x600000)),
		Segment::IMG6,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x700000)),
		Segment::IMG7,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0x800000)),
		Segment::WRAM,
	);

	assert_eq!(
		Segment::from_v_addr(Long::from_u32(0xF00000)),
		Segment::IO,
	);
}