From b5227f58d30d4675639f5782b8b0b4d710c91f6f Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 1 Jun 2022 15:35:00 +0100 Subject: [PATCH] Code cleanup for X10D.Tests --- X10D.Tests/src/Collections/Int16Tests.cs | 2 +- X10D.Tests/src/Collections/Int32Tests.cs | 2 +- X10D.Tests/src/Core/EnumTests.cs | 8 ++++---- X10D.Tests/src/Linq/Int16Tests.cs | 2 +- X10D.Tests/src/Math/Int16Tests.cs | 4 ++-- X10D.Tests/src/Math/Int32Tests.cs | 4 ++-- X10D.Tests/src/Math/Int64Tests.cs | 4 ++-- X10D.Tests/src/Math/UInt16Tests.cs | 6 +++--- X10D.Tests/src/Math/UInt64Tests.cs | 4 ++-- X10D.Tests/src/Numerics/Int16Tests.cs | 2 +- X10D.Tests/src/Numerics/UInt32Tests.cs | 4 +++- X10D.Tests/src/Text/CharTests.cs | 3 +-- 12 files changed, 23 insertions(+), 22 deletions(-) diff --git a/X10D.Tests/src/Collections/Int16Tests.cs b/X10D.Tests/src/Collections/Int16Tests.cs index d077744..c97f34d 100644 --- a/X10D.Tests/src/Collections/Int16Tests.cs +++ b/X10D.Tests/src/Collections/Int16Tests.cs @@ -10,7 +10,7 @@ public class Int16Tests public void UnpackBits_ShouldUnpackToArrayCorrectly() { bool[] bits = ((short)0b11010100).Unpack(); - + Assert.AreEqual(16, bits.Length); Assert.IsFalse(bits[0]); diff --git a/X10D.Tests/src/Collections/Int32Tests.cs b/X10D.Tests/src/Collections/Int32Tests.cs index cd86c75..e29b72f 100644 --- a/X10D.Tests/src/Collections/Int32Tests.cs +++ b/X10D.Tests/src/Collections/Int32Tests.cs @@ -10,7 +10,7 @@ public class Int32Tests public void UnpackBits_ShouldUnpackToArrayCorrectly() { bool[] bits = 0b11010100.Unpack(); - + Assert.AreEqual(32, bits.Length); Assert.IsFalse(bits[0]); diff --git a/X10D.Tests/src/Core/EnumTests.cs b/X10D.Tests/src/Core/EnumTests.cs index 8e7889d..a96ecc0 100644 --- a/X10D.Tests/src/Core/EnumTests.cs +++ b/X10D.Tests/src/Core/EnumTests.cs @@ -11,7 +11,7 @@ public class EnumTests // it's clearly Monday as defined by ISO 8601. // but Microsoft can't fix this without breaking compatibility. // I have feelings... - + [TestMethod] public void Next() { @@ -23,7 +23,7 @@ public class EnumTests Assert.AreEqual(DayOfWeek.Saturday, DayOfWeek.Friday.Next()); Assert.AreEqual(DayOfWeek.Sunday, DayOfWeek.Saturday.Next()); // Saturday is the "last" day. wrap to "first" } - + [TestMethod] public void NextUnchecked() { @@ -35,7 +35,7 @@ public class EnumTests Assert.AreEqual(DayOfWeek.Saturday, DayOfWeek.Friday.NextUnchecked()); Assert.ThrowsException(() => DayOfWeek.Saturday.NextUnchecked()); } - + [TestMethod] public void Previous() { @@ -47,7 +47,7 @@ public class EnumTests Assert.AreEqual(DayOfWeek.Thursday, DayOfWeek.Friday.Previous()); Assert.AreEqual(DayOfWeek.Friday, DayOfWeek.Saturday.Previous()); } - + [TestMethod] public void PreviousUnchecked() { diff --git a/X10D.Tests/src/Linq/Int16Tests.cs b/X10D.Tests/src/Linq/Int16Tests.cs index c0f0636..14507f7 100644 --- a/X10D.Tests/src/Linq/Int16Tests.cs +++ b/X10D.Tests/src/Linq/Int16Tests.cs @@ -10,7 +10,7 @@ public class Int16Tests public void ProductShouldBeCorrect() { short Cast(int i) => (short)i; - + Assert.AreEqual(0, Enumerable.Range(0, 10).Select(Cast).Product()); Assert.AreEqual(1, Enumerable.Range(1, 1).Select(Cast).Product()); Assert.AreEqual(2, Enumerable.Range(1, 2).Select(Cast).Product()); diff --git a/X10D.Tests/src/Math/Int16Tests.cs b/X10D.Tests/src/Math/Int16Tests.cs index 15edb9a..8500f68 100644 --- a/X10D.Tests/src/Math/Int16Tests.cs +++ b/X10D.Tests/src/Math/Int16Tests.cs @@ -35,7 +35,7 @@ public class Int16Tests { const short one = 1; const short two = 2; - + Assert.IsFalse(one.IsEven()); Assert.IsTrue(two.IsEven()); } @@ -45,7 +45,7 @@ public class Int16Tests { const short one = 1; const short two = 2; - + Assert.IsTrue(one.IsOdd()); Assert.IsFalse(two.IsOdd()); } diff --git a/X10D.Tests/src/Math/Int32Tests.cs b/X10D.Tests/src/Math/Int32Tests.cs index db0d5fb..bb35f8c 100644 --- a/X10D.Tests/src/Math/Int32Tests.cs +++ b/X10D.Tests/src/Math/Int32Tests.cs @@ -35,7 +35,7 @@ public class Int32Tests { const int one = 1; const int two = 2; - + Assert.IsFalse(one.IsEven()); Assert.IsTrue(two.IsEven()); } @@ -45,7 +45,7 @@ public class Int32Tests { const int one = 1; const int two = 2; - + Assert.IsTrue(one.IsOdd()); Assert.IsFalse(two.IsOdd()); } diff --git a/X10D.Tests/src/Math/Int64Tests.cs b/X10D.Tests/src/Math/Int64Tests.cs index 44acb55..0a857f4 100644 --- a/X10D.Tests/src/Math/Int64Tests.cs +++ b/X10D.Tests/src/Math/Int64Tests.cs @@ -35,7 +35,7 @@ public class Int64Tests { const long one = 1; const long two = 2; - + Assert.IsFalse(one.IsEven()); Assert.IsTrue(two.IsEven()); } @@ -45,7 +45,7 @@ public class Int64Tests { const long one = 1; const long two = 2; - + Assert.IsTrue(one.IsOdd()); Assert.IsFalse(two.IsOdd()); } diff --git a/X10D.Tests/src/Math/UInt16Tests.cs b/X10D.Tests/src/Math/UInt16Tests.cs index ac8575a..471537d 100644 --- a/X10D.Tests/src/Math/UInt16Tests.cs +++ b/X10D.Tests/src/Math/UInt16Tests.cs @@ -14,7 +14,7 @@ public class UInt16Tests Assert.AreEqual(4, value.DigitalRoot()); Assert.AreEqual(4, (-value).DigitalRoot()); } - + [TestMethod] public void FactorialShouldBeCorrect() { @@ -36,7 +36,7 @@ public class UInt16Tests { const ushort one = 1; const ushort two = 2; - + Assert.IsFalse(one.IsEven()); Assert.IsTrue(two.IsEven()); } @@ -46,7 +46,7 @@ public class UInt16Tests { const ushort one = 1; const ushort two = 2; - + Assert.IsTrue(one.IsOdd()); Assert.IsFalse(two.IsOdd()); } diff --git a/X10D.Tests/src/Math/UInt64Tests.cs b/X10D.Tests/src/Math/UInt64Tests.cs index d18a7d6..ff7cdbd 100644 --- a/X10D.Tests/src/Math/UInt64Tests.cs +++ b/X10D.Tests/src/Math/UInt64Tests.cs @@ -40,7 +40,7 @@ public class UInt64Tests { const ulong one = 1; const ulong two = 2; - + Assert.IsFalse(one.IsEven()); Assert.IsTrue(two.IsEven()); } @@ -50,7 +50,7 @@ public class UInt64Tests { const ulong one = 1; const ulong two = 2; - + Assert.IsTrue(one.IsOdd()); Assert.IsFalse(two.IsOdd()); } diff --git a/X10D.Tests/src/Numerics/Int16Tests.cs b/X10D.Tests/src/Numerics/Int16Tests.cs index 5a40597..c7bba00 100644 --- a/X10D.Tests/src/Numerics/Int16Tests.cs +++ b/X10D.Tests/src/Numerics/Int16Tests.cs @@ -56,7 +56,7 @@ public class Int16Tests { for (var i = 0; i < 8; i++) { - var value = (short) System.Math.Pow(2, i); + var value = (short)System.Math.Pow(2, i); Assert.AreEqual(value, value.RoundUpToPowerOf2()); } } diff --git a/X10D.Tests/src/Numerics/UInt32Tests.cs b/X10D.Tests/src/Numerics/UInt32Tests.cs index 6cc6c94..03438ae 100644 --- a/X10D.Tests/src/Numerics/UInt32Tests.cs +++ b/X10D.Tests/src/Numerics/UInt32Tests.cs @@ -39,7 +39,9 @@ public class UInt32Tests { const uint value = 284719; // 00000000 00000100 01011000 00101111 Assert.AreEqual(value, value.RotateRight(32)); - } [TestMethod] + } + + [TestMethod] public void RoundUpToPowerOf2_ShouldReturnRoundedValue_GivenValue() { Assert.AreEqual(4U, 3U.RoundUpToPowerOf2()); diff --git a/X10D.Tests/src/Text/CharTests.cs b/X10D.Tests/src/Text/CharTests.cs index 7963f21..7ace536 100644 --- a/X10D.Tests/src/Text/CharTests.cs +++ b/X10D.Tests/src/Text/CharTests.cs @@ -1,5 +1,4 @@ -using System.Text; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; using X10D.Text; namespace X10D.Tests.Text;