Browse Source

Fix hashcode test

pull/2371/head
Stefan Nikolei 3 years ago
parent
commit
531c110505
  1. 19
      tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs

19
tests/ImageSharp.Tests/Primitives/ColorMatrixTests.cs

@ -2,6 +2,7 @@
// Licensed under the Six Labors Split License.
using System.Globalization;
using System.Numerics;
using SixLabors.ImageSharp.Processing;
namespace SixLabors.ImageSharp.Tests.Primitives;
@ -115,7 +116,23 @@ public class ColorMatrixTests
public void ColorMatrixHashCode()
{
ColorMatrix m = KnownFilterMatrices.CreateBrightnessFilter(.5F);
HashCode hash = default;
#if NET7_0_OR_GREATER
Vector4 x = new(m.M11, m.M12, m.M13, m.M14);
Vector4 y = new(m.M21, m.M22, m.M23, m.M24);
Vector4 z = new(m.M31, m.M32, m.M33, m.M34);
Vector4 w = new(m.M41, m.M42, m.M43, m.M44);
Vector4 v = new(m.M51, m.M52, m.M53, m.M54);
hash.Add(x);
hash.Add(y);
hash.Add(z);
hash.Add(w);
hash.Add(v);
#endif
#if NET6_0
hash.Add(m.M11);
hash.Add(m.M12);
hash.Add(m.M13);
@ -136,6 +153,8 @@ public class ColorMatrixTests
hash.Add(m.M52);
hash.Add(m.M53);
hash.Add(m.M54);
#endif
Assert.Equal(hash.ToHashCode(), m.GetHashCode());
}

Loading…
Cancel
Save