// Copyright 2025 Gabriel Bjørnager Jensen.

#![cfg(test)]

use crate::Uint;

#[test]
fn test_uint() {
	let mut value0 = 0x0u8;
	let mut value1 = 0x0u16;
	let mut value2 = 0x0u32;
	let mut value3 = 0x0u64;
	let mut value4 = 0x0u128;

	fn op<T: Uint>(value: &mut T) {
		*value = T::from_u8(0x1);

		*value = value.wrapping_sub(T::from_u8(0x2));
	}

	op(&mut value0);
	op(&mut value1);
	op(&mut value2);
	op(&mut value3);
	op(&mut value4);

	assert_eq!(value0, 0xFF);
	assert_eq!(value1, 0xFF_FF);
	assert_eq!(value2, 0xFF_FF_FF_FF);
	assert_eq!(value3, 0xFF_FF_FF_FF_FF_FF_FF_FF);
	assert_eq!(value4, 0xFF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF_FF);
}
