From f5d415dfef59177d32fc910e55c2619b604fbfca Mon Sep 17 00:00:00 2001 From: Michael Durrant Date: Mon, 31 Jul 2023 13:27:14 -0600 Subject: [PATCH] More test cases, debug statements --- .../Graphics/AstcDecoderTests.cs | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Ryujinx.Tests/Graphics/AstcDecoderTests.cs b/src/Ryujinx.Tests/Graphics/AstcDecoderTests.cs index 221b3bfb96..3f7532a06e 100644 --- a/src/Ryujinx.Tests/Graphics/AstcDecoderTests.cs +++ b/src/Ryujinx.Tests/Graphics/AstcDecoderTests.cs @@ -54,8 +54,21 @@ namespace Ryujinx.Tests.Graphics // public void [TestCase(4, 4)] [TestCase(5, 5)] + [TestCase(5, 4)] + [TestCase(6, 5)] + [TestCase(6, 6)] + [TestCase(8, 5)] + [TestCase(8, 6)] + [TestCase(8, 8)] + [TestCase(10, 5)] + [TestCase(10, 6)] + [TestCase(10, 8)] + [TestCase(10, 10)] + [TestCase(12, 10)] + [TestCase(12, 12)] public void Paramterized_BlockSizes_Test(int blockWidth, int blockHeight) - { + { + TestContext.Out.WriteLine($"Testing Block Size {blockWidth}x{blockHeight}"); var (encodedRef, decodedRef) = _getTestDataTupleFromShortname("MoreRocks", blockWidth, blockHeight); int astcHeaderLength = 16; @@ -72,7 +85,6 @@ namespace Ryujinx.Tests.Graphics bool succeeded = AstcDecoder.TryDecodeToRgba8P(rawastc, blockWidth, blockHeight, texWidth, texHeight, depth, levels, layers, out outputBuffer); - // The decode function said it was valid data and that it could parse it. Assert.AreEqual(true, succeeded); // Length is the same as the one we made w/ ARM's decoder. That's good. @@ -92,14 +104,15 @@ namespace Ryujinx.Tests.Graphics var wordUnchangedCount = wordDifferences.Count(x => x.diff.IsZero()); var wordUnchangedPercent = (float)wordUnchangedCount / wordDifferences.Count(); - Debug.WriteLine($"Pixel-wise comparison: {wordUnchangedPercent * 100:F4} ({wordUnchangedCount}/{wordDifferences.Length})"); - Debug.WriteLine($"Byte-wise comparison: {matchPercent * 100:F4} ({matchCount}/{byteDifferences.Count}) were same."); + TestContext.Out.WriteLine($"Pixel-wise comparison: {wordUnchangedPercent * 100:F4} ({wordUnchangedCount}/{wordDifferences.Length})"); + TestContext.Out.WriteLine($"Byte-wise comparison: {matchPercent * 100:F4} ({matchCount}/{byteDifferences.Count}) were same."); - for (var threshold = 1; threshold < 16; threshold++) + for (var threshold = 1; threshold < 32; threshold++) { var tc = byteDifferences.Count(x => Math.Abs(x.delta) >= threshold); var tcp = ((float)tc / byteDifferences.Count); - Debug.WriteLine($"{tcp * 100:F4}% ({tc}/{byteDifferences.Count}) are different by at least {threshold}."); + if (tc >0) + TestContext.Out.WriteLine($"{tcp * 100:F4}% ({tc}/{byteDifferences.Count}) are different by at least {threshold}."); } Assert.IsTrue(byteDifferences.All(x => Math.Abs(x.delta) < 2));