From c5de894b685bb8eda175cb54dc693f4881b1d764 Mon Sep 17 00:00:00 2001 From: Phil Date: Sat, 11 May 2024 16:29:42 -0700 Subject: [PATCH] - WIP --- Source/Mosa.Utility.UnitTests/Numbers/C.cs | 2 +- Source/Mosa.Utility.UnitTests/Numbers/I1.cs | 13 ++++++++++++- Source/Mosa.Utility.UnitTests/Numbers/I2.cs | 13 ++++++++++++- Source/Mosa.Utility.UnitTests/Numbers/I4.cs | 13 ++++++++++++- Source/Mosa.Utility.UnitTests/Numbers/I8.cs | 13 ++++++++++++- Source/Mosa.Utility.UnitTests/Numbers/R4.cs | 2 +- Source/Mosa.Utility.UnitTests/Numbers/R8.cs | 2 +- Source/Mosa.Utility.UnitTests/Numbers/U1.cs | 14 ++++++++++++-- Source/Mosa.Utility.UnitTests/Numbers/U2.cs | 13 ++++++++++++- Source/Mosa.Utility.UnitTests/Numbers/U4.cs | 13 ++++++++++++- Source/Mosa.Utility.UnitTests/Numbers/U8.cs | 13 ++++++++++++- 11 files changed, 99 insertions(+), 12 deletions(-) diff --git a/Source/Mosa.Utility.UnitTests/Numbers/C.cs b/Source/Mosa.Utility.UnitTests/Numbers/C.cs index c3af9e3a79..ee893cdf2f 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/C.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/C.cs @@ -10,7 +10,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/I1.cs b/Source/Mosa.Utility.UnitTests/Numbers/I1.cs index b56d3ca692..66f0426972 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/I1.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/I1.cs @@ -1,5 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; + namespace Mosa.Utility.UnitTests.Numbers; public static class I1 @@ -10,7 +12,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; @@ -33,6 +35,15 @@ public static IList GetSeries() AddNegatives(list); list = list.Distinct().ToList(); + + //for (var i = 0; i < 7; i++) + //{ + // var v = 1 << i; + // list.AddIfNew((sbyte)v); + // list.AddIfNew((sbyte)(v + 1)); + // list.AddIfNew((sbyte)(v - 2)); + //} + list.Sort(); return list; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/I2.cs b/Source/Mosa.Utility.UnitTests/Numbers/I2.cs index d165d64bd5..facd53e8c5 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/I2.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/I2.cs @@ -1,5 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; + namespace Mosa.Utility.UnitTests.Numbers; public static class I2 @@ -10,7 +12,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; @@ -38,6 +40,15 @@ public static IList GetSeries() AddNegatives(list); list = list.Distinct().ToList(); + + //for (var i = 0; i < 15; i++) + //{ + // var v = 1 << i; + // list.AddIfNew((short)v); + // list.AddIfNew((short)(v + 1)); + // list.AddIfNew((short)(v - 2)); + //} + list.Sort(); return list; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/I4.cs b/Source/Mosa.Utility.UnitTests/Numbers/I4.cs index 18258bbde7..d959425a0b 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/I4.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/I4.cs @@ -1,5 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; + namespace Mosa.Utility.UnitTests.Numbers; public static class I4 @@ -10,7 +12,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; @@ -44,6 +46,15 @@ public static IList GetSeries() AddNegatives(list); list = list.Distinct().ToList(); + + //for (var i = 0; i < 31; i++) + //{ + // var v = 1 << i; + // list.AddIfNew(v); + // list.AddIfNew(v + 1); + // list.AddIfNew(v - 2); + //} + list.Sort(); return list; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/I8.cs b/Source/Mosa.Utility.UnitTests/Numbers/I8.cs index e6fb5272bc..e0ab527a8d 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/I8.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/I8.cs @@ -1,5 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; + namespace Mosa.Utility.UnitTests.Numbers; public static class I8 @@ -10,7 +12,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; @@ -46,6 +48,15 @@ public static IList GetSeries() AddNegatives(list); list = list.Distinct().ToList(); + + //for (var i = 0; i < 63; i++) + //{ + // var v = 1 << i; + // list.AddIfNew(v); + // list.AddIfNew(v + 1); + // list.AddIfNew(v - 2); + //} + list.Sort(); return list; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/R4.cs b/Source/Mosa.Utility.UnitTests/Numbers/R4.cs index 5e48e869e6..a0348f746f 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/R4.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/R4.cs @@ -10,7 +10,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/R8.cs b/Source/Mosa.Utility.UnitTests/Numbers/R8.cs index 800b891e9a..452a1ea2de 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/R8.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/R8.cs @@ -10,7 +10,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/U1.cs b/Source/Mosa.Utility.UnitTests/Numbers/U1.cs index 39c14fe851..6188e18b13 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/U1.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/U1.cs @@ -1,5 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; + namespace Mosa.Utility.UnitTests.Numbers; public static class U1 @@ -10,7 +12,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; @@ -31,8 +33,16 @@ public static IList GetSeries() }; list = list.Distinct().ToList(); - list.Sort(); + //for (var i = 0; i < 7; i++) + //{ + // var v = 1 << i; + // list.AddIfNew((byte)v); + // list.AddIfNew((byte)(v + 1)); + // list.AddIfNew((byte)(v - 2)); + //} + + list.Sort(); return list; } } diff --git a/Source/Mosa.Utility.UnitTests/Numbers/U2.cs b/Source/Mosa.Utility.UnitTests/Numbers/U2.cs index 4f1cf8a23c..5c4f817771 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/U2.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/U2.cs @@ -1,5 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; + namespace Mosa.Utility.UnitTests.Numbers; public static class U2 @@ -10,7 +12,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; @@ -35,6 +37,15 @@ public static IList GetSeries() }; list = list.Distinct().ToList(); + + //for (var i = 0; i < 15; i++) + //{ + // var v = 1 << i; + // list.AddIfNew((ushort)v); + // list.AddIfNew((ushort)(v + 1)); + // list.AddIfNew((ushort)(v - 2)); + //} + list.Sort(); return list; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/U4.cs b/Source/Mosa.Utility.UnitTests/Numbers/U4.cs index a893cf3828..d5438cc23f 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/U4.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/U4.cs @@ -1,5 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; + namespace Mosa.Utility.UnitTests.Numbers; public static class U4 @@ -10,7 +12,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; @@ -39,6 +41,15 @@ public static IList GetSeries() }; list = list.Distinct().ToList(); + + //for (var i = 0; i < 31; i++) + //{ + // var v = 1u << i; + // list.AddIfNew(v); + // list.AddIfNew(v + 1); + // list.AddIfNew(v - 2); + //} + list.Sort(); return list; diff --git a/Source/Mosa.Utility.UnitTests/Numbers/U8.cs b/Source/Mosa.Utility.UnitTests/Numbers/U8.cs index c7afef0093..72fa86a423 100644 --- a/Source/Mosa.Utility.UnitTests/Numbers/U8.cs +++ b/Source/Mosa.Utility.UnitTests/Numbers/U8.cs @@ -1,5 +1,7 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. +using Mosa.Compiler.Common; + namespace Mosa.Utility.UnitTests.Numbers; public static class U8 @@ -10,7 +12,7 @@ public static IEnumerable Series { get { - if (series == null) series = GetSeries(); + series ??= GetSeries(); foreach (var value in series) yield return value; @@ -43,6 +45,15 @@ public static IList GetSeries() }; list = list.Distinct().ToList(); + + //for (var i = 0; i < 63; i++) + //{ + // var v = 1ul << i; + // list.AddIfNew(v); + // list.AddIfNew(v + 1); + // list.AddIfNew(v - 2); + //} + list.Sort(); return list;