From a1140041ecbb51087e37fe3372d5e4fff3cf9ce6 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Sun, 17 Sep 2023 18:13:47 +0200 Subject: [PATCH] Updated unit tests due to changes in the limits of ImageMagick. --- .../ResourceLimitsTests/TheHeightProperty.cs | 12 ++++-------- .../ResourceLimitsTests/TheWidthProperty.cs | 12 ++++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/tests/Magick.NET.Tests/ResourceLimitsTests/TheHeightProperty.cs b/tests/Magick.NET.Tests/ResourceLimitsTests/TheHeightProperty.cs index 3eed6a64b5..09cfa7d74a 100644 --- a/tests/Magick.NET.Tests/ResourceLimitsTests/TheHeightProperty.cs +++ b/tests/Magick.NET.Tests/ResourceLimitsTests/TheHeightProperty.cs @@ -24,14 +24,10 @@ public class TheHeightProperty [Fact] public void ShouldHaveTheCorrectValue() { - if (Runtime.Is64Bit) - { - Assert.Equal(1844674407370955161U / sizeof(QuantumType), ResourceLimits.Height); - } - else - { - Assert.Equal(429496729U / sizeof(QuantumType), ResourceLimits.Height); - } + var memoryLimit = Runtime.Is64Bit ? (ulong)long.MaxValue : int.MaxValue; + var maxChannels = 64UL; + + Assert.Equal(memoryLimit / sizeof(QuantumType) / maxChannels, ResourceLimits.Height); } [Fact] diff --git a/tests/Magick.NET.Tests/ResourceLimitsTests/TheWidthProperty.cs b/tests/Magick.NET.Tests/ResourceLimitsTests/TheWidthProperty.cs index 07a87d272f..ed081ec8f7 100644 --- a/tests/Magick.NET.Tests/ResourceLimitsTests/TheWidthProperty.cs +++ b/tests/Magick.NET.Tests/ResourceLimitsTests/TheWidthProperty.cs @@ -24,14 +24,10 @@ public class TheWidthProperty [Fact] public void ShouldHaveTheCorrectValue() { - if (Runtime.Is64Bit) - { - Assert.Equal(1844674407370955161U / sizeof(QuantumType), ResourceLimits.Width); - } - else - { - Assert.Equal(429496729U / sizeof(QuantumType), ResourceLimits.Width); - } + var memoryLimit = Runtime.Is64Bit ? (ulong)long.MaxValue : int.MaxValue; + var maxChannels = 64UL; + + Assert.Equal(memoryLimit / sizeof(QuantumType) / maxChannels, ResourceLimits.Width); } [Fact]