looklook 0.5.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
// version.
//
// LOOKLOOK is distributed in the hope that it will
// be useful, but WITHOUT ANY WARRANTY; 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 Af-
// fero General Public License along with LOOKLOOK.
// If not, see <https://www.gnu.org/licenses/>.

//! Tests for [`SampleDepth`].

#![cfg(test)]

use crate::mode::SampleDepth;
use crate::mode::sample_depth::Inner;

#[cfg(not(miri))]
use std::assert_matches;

// NOTE: This one is way too slow -- not to mention
// on MIRI.
#[cfg(not(miri))]
#[test]
fn test_invalid_sample_depth() {
	for value in 0..=0 {
		assert_matches!(SampleDepth::new(value), None);
	}

	for value in 9..=u32::MAX {
		assert_matches!(SampleDepth::new(value), None);
	}
}

#[test]
fn test_sample_depth() {
	for value in 1..=8 {
		let depth = SampleDepth::new(value).unwrap();

		assert_eq!(depth.get(), value);

		assert_eq!(depth.as_u64(), u64::from(value));
	}
}

#[test]
fn test_sample_depth_inner() {
	assert_eq!(Inner::U8 as u8,  1);
	assert_eq!(Inner::U16 as u8, 2);
	assert_eq!(Inner::U24 as u8, 3);
	assert_eq!(Inner::U32 as u8, 4);
	assert_eq!(Inner::U40 as u8, 5);
	assert_eq!(Inner::U48 as u8, 6);
	assert_eq!(Inner::U56 as u8, 7);
	assert_eq!(Inner::U64 as u8, 8);
}