// Copyright 2025 Gabriel Bjørnager Jensen.

#![cfg(test)]

use core::array;
use multitype::Array;

#[test]
fn test_array_is_ascii() {
	let data0: [u8; 0x7] = array::from_fn(|i| 0x2u16.wrapping_pow(i as u32).wrapping_sub(0x1) as u8);
	let data1: [u8; 0x9] = array::from_fn(|i| 0x2u16.wrapping_pow(i as u32).wrapping_sub(0x1) as u8);

	fn f<T: Array<Scalar = u8>>(data: &T) -> bool {
		data.as_slice().is_ascii()
	}

	assert!(f(&data0));
	assert!(!f(&data1));
}
