From 6e7e162ffe67038ddb7aa71ef019fc72397312a6 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Fri, 31 Mar 2023 23:19:21 +0100 Subject: [PATCH] test: 100% coverage on MultiplicativePersistence --- X10D.Tests/src/Math/ByteTests.cs | 9 +++++++++ X10D.Tests/src/Math/Int16Tests.cs | 9 +++++++++ X10D.Tests/src/Math/Int32Tests.cs | 9 +++++++++ X10D.Tests/src/Math/Int64Tests.cs | 9 +++++++++ X10D.Tests/src/Math/SByteTests.cs | 9 +++++++++ X10D.Tests/src/Math/UInt16Tests.cs | 9 +++++++++ X10D.Tests/src/Math/UInt32Tests.cs | 9 +++++++++ X10D.Tests/src/Math/UInt64Tests.cs | 9 +++++++++ 8 files changed, 72 insertions(+) diff --git a/X10D.Tests/src/Math/ByteTests.cs b/X10D.Tests/src/Math/ByteTests.cs index 791289b..166754f 100644 --- a/X10D.Tests/src/Math/ByteTests.cs +++ b/X10D.Tests/src/Math/ByteTests.cs @@ -122,6 +122,15 @@ public partial class ByteTests Assert.AreEqual(expected, result); } + [TestMethod] + public void MultiplicativePersistence_ShouldReturn1_ForAnyDigitBeing0() + { + Assert.AreEqual(1, ((byte)10).MultiplicativePersistence()); + Assert.AreEqual(1, ((byte)201).MultiplicativePersistence()); + Assert.AreEqual(1, ((byte)200).MultiplicativePersistence()); + Assert.AreEqual(1, ((byte)207).MultiplicativePersistence()); + } + [TestMethod] public void MultiplicativePersistence_ShouldBeCorrect_ForRecordHolders() { diff --git a/X10D.Tests/src/Math/Int16Tests.cs b/X10D.Tests/src/Math/Int16Tests.cs index f605cc0..1cfac50 100644 --- a/X10D.Tests/src/Math/Int16Tests.cs +++ b/X10D.Tests/src/Math/Int16Tests.cs @@ -134,6 +134,15 @@ public partial class Int16Tests Assert.AreEqual(expected, result); } + [TestMethod] + public void MultiplicativePersistence_ShouldReturn1_ForAnyDigitBeing0() + { + Assert.AreEqual(1, ((short)10).MultiplicativePersistence()); + Assert.AreEqual(1, ((short)201).MultiplicativePersistence()); + Assert.AreEqual(1, ((short)200).MultiplicativePersistence()); + Assert.AreEqual(1, ((short)20007).MultiplicativePersistence()); + } + [TestMethod] public void MultiplicativePersistence_ShouldBeCorrect_ForRecordHolders() { diff --git a/X10D.Tests/src/Math/Int32Tests.cs b/X10D.Tests/src/Math/Int32Tests.cs index 252a17e..66246d3 100644 --- a/X10D.Tests/src/Math/Int32Tests.cs +++ b/X10D.Tests/src/Math/Int32Tests.cs @@ -134,6 +134,15 @@ public partial class Int32Tests Assert.AreEqual(expected, result2); } + [TestMethod] + public void MultiplicativePersistence_ShouldReturn1_ForAnyDigitBeing0() + { + Assert.AreEqual(1, 10.MultiplicativePersistence()); + Assert.AreEqual(1, 201.MultiplicativePersistence()); + Assert.AreEqual(1, 200.MultiplicativePersistence()); + Assert.AreEqual(1, 20007.MultiplicativePersistence()); + } + [TestMethod] public void MultiplicativePersistence_ShouldBeCorrect_ForRecordHolders() { diff --git a/X10D.Tests/src/Math/Int64Tests.cs b/X10D.Tests/src/Math/Int64Tests.cs index ac397ad..cf6d345 100644 --- a/X10D.Tests/src/Math/Int64Tests.cs +++ b/X10D.Tests/src/Math/Int64Tests.cs @@ -134,6 +134,15 @@ public partial class Int64Tests Assert.AreEqual(expected, result); } + [TestMethod] + public void MultiplicativePersistence_ShouldReturn1_ForAnyDigitBeing0() + { + Assert.AreEqual(1, 10L.MultiplicativePersistence()); + Assert.AreEqual(1, 201L.MultiplicativePersistence()); + Assert.AreEqual(1, 200L.MultiplicativePersistence()); + Assert.AreEqual(1, 20007L.MultiplicativePersistence()); + } + [TestMethod] public void MultiplicativePersistence_ShouldBeCorrect_ForRecordHolders() { diff --git a/X10D.Tests/src/Math/SByteTests.cs b/X10D.Tests/src/Math/SByteTests.cs index 4d9b9e2..3874515 100644 --- a/X10D.Tests/src/Math/SByteTests.cs +++ b/X10D.Tests/src/Math/SByteTests.cs @@ -135,6 +135,15 @@ public partial class SByteTests Assert.AreEqual(expected, result); } + [TestMethod] + public void MultiplicativePersistence_ShouldReturn1_ForAnyDigitBeing0() + { + Assert.AreEqual(1, ((sbyte)10).MultiplicativePersistence()); + Assert.AreEqual(1, ((sbyte)20).MultiplicativePersistence()); + Assert.AreEqual(1, ((sbyte)101).MultiplicativePersistence()); + Assert.AreEqual(1, ((sbyte)120).MultiplicativePersistence()); + } + [TestMethod] public void MultiplicativePersistence_ShouldBeCorrect_ForRecordHolders() { diff --git a/X10D.Tests/src/Math/UInt16Tests.cs b/X10D.Tests/src/Math/UInt16Tests.cs index 21e3def..d873829 100644 --- a/X10D.Tests/src/Math/UInt16Tests.cs +++ b/X10D.Tests/src/Math/UInt16Tests.cs @@ -123,6 +123,15 @@ public partial class UInt16Tests Assert.AreEqual(expected, result); } + [TestMethod] + public void MultiplicativePersistence_ShouldReturn1_ForAnyDigitBeing0() + { + Assert.AreEqual(1, ((ushort)10).MultiplicativePersistence()); + Assert.AreEqual(1, ((ushort)201).MultiplicativePersistence()); + Assert.AreEqual(1, ((ushort)200).MultiplicativePersistence()); + Assert.AreEqual(1, ((ushort)20007).MultiplicativePersistence()); + } + [TestMethod] public void MultiplicativePersistence_ShouldBeCorrect_ForRecordHolders() { diff --git a/X10D.Tests/src/Math/UInt32Tests.cs b/X10D.Tests/src/Math/UInt32Tests.cs index b2337d0..4454642 100644 --- a/X10D.Tests/src/Math/UInt32Tests.cs +++ b/X10D.Tests/src/Math/UInt32Tests.cs @@ -123,6 +123,15 @@ public partial class UInt32Tests Assert.AreEqual(expected, result); } + [TestMethod] + public void MultiplicativePersistence_ShouldReturn1_ForAnyDigitBeing0() + { + Assert.AreEqual(1, 10U.MultiplicativePersistence()); + Assert.AreEqual(1, 201U.MultiplicativePersistence()); + Assert.AreEqual(1, 200U.MultiplicativePersistence()); + Assert.AreEqual(1, 20007U.MultiplicativePersistence()); + } + [TestMethod] public void MultiplicativePersistence_ShouldBeCorrect_ForRecordHolders() { diff --git a/X10D.Tests/src/Math/UInt64Tests.cs b/X10D.Tests/src/Math/UInt64Tests.cs index 432e4f2..c5e81ba 100644 --- a/X10D.Tests/src/Math/UInt64Tests.cs +++ b/X10D.Tests/src/Math/UInt64Tests.cs @@ -125,6 +125,15 @@ public partial class UInt64Tests Assert.AreEqual(expected, result); } + [TestMethod] + public void MultiplicativePersistence_ShouldReturn1_ForAnyDigitBeing0() + { + Assert.AreEqual(1, 10UL.MultiplicativePersistence()); + Assert.AreEqual(1, 201UL.MultiplicativePersistence()); + Assert.AreEqual(1, 200UL.MultiplicativePersistence()); + Assert.AreEqual(1, 20007UL.MultiplicativePersistence()); + } + [TestMethod] public void MultiplicativePersistence_ShouldBeCorrect_ForRecordHolders() {