using AssetRipper.TextureDecoder.Rgb; using System.Numerics; namespace AssetRipper.TextureDecoder.Tests.Formats.Generic; [TestFixture(TypeArgs = [typeof(sbyte), typeof(byte)])] [TestFixture(TypeArgs = [typeof(short), typeof(ushort)])] [TestFixture(TypeArgs = [typeof(int), typeof(uint)])] [TestFixture(TypeArgs = [typeof(long), typeof(ulong)])] [TestFixture(TypeArgs = [typeof(Int128), typeof(UInt128)])] internal class NumericConversionExtremesTests where TSigned : unmanaged, IMinMaxValue where TUnsigned : unmanaged, IMinMaxValue { [Test] public void SignedToUnsignedExtremesAreCorrect() { using (Assert.EnterMultipleScope()) { Assert.That(NumericConversion.Convert(TSigned.MinValue), Is.EqualTo(TUnsigned.MinValue)); Assert.That(NumericConversion.Convert(TSigned.MaxValue), Is.EqualTo(TUnsigned.MaxValue)); } } [Test] public void UnsignedToSignedExtremesAreCorrect() { using (Assert.EnterMultipleScope()) { Assert.That(NumericConversion.Convert(TUnsigned.MinValue), Is.EqualTo(TSigned.MinValue)); Assert.That(NumericConversion.Convert(TUnsigned.MaxValue), Is.EqualTo(TSigned.MaxValue)); } } }