mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 21:24:58 +00:00
refactor: Removing unused code
This commit is contained in:
@@ -36,18 +36,10 @@ namespace ICD.Common.Utils.Tests
|
|||||||
Assert.AreEqual(100, MathUtils.MapRange(0, 10, 0, 100, 10));
|
Assert.AreEqual(100, MathUtils.MapRange(0, 10, 0, 100, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
[UsedImplicitly]
|
|
||||||
[TestCase(-10000, 5)]
|
|
||||||
[TestCase(10000, 5)]
|
|
||||||
public void GetNumberOfDigitsTest(int number, int expected)
|
|
||||||
{
|
|
||||||
Assert.AreEqual(expected, MathUtils.GetNumberOfDigits(number));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test, UsedImplicitly]
|
[Test, UsedImplicitly]
|
||||||
public void GetRangesTest()
|
public void GetRangesTest()
|
||||||
{
|
{
|
||||||
IEnumerable<int> values = new int[] { 1, 3, 5, 6, 7, 8, 9, 10, 12 };
|
IEnumerable<int> values = new [] { 1, 3, 5, 6, 7, 8, 9, 10, 12 };
|
||||||
int[][] ranges = MathUtils.GetRanges(values).ToArray();
|
int[][] ranges = MathUtils.GetRanges(values).ToArray();
|
||||||
|
|
||||||
Assert.AreEqual(4, ranges.Length);
|
Assert.AreEqual(4, ranges.Length);
|
||||||
@@ -68,7 +60,7 @@ namespace ICD.Common.Utils.Tests
|
|||||||
[Test, UsedImplicitly]
|
[Test, UsedImplicitly]
|
||||||
public void RoundToNearestTest()
|
public void RoundToNearestTest()
|
||||||
{
|
{
|
||||||
IEnumerable<int> values = new int[] { 0, 15, 30, 45 };
|
IEnumerable<int> values = new [] { 0, 15, 30, 45 };
|
||||||
Assert.AreEqual(15, MathUtils.RoundToNearest(21, values));
|
Assert.AreEqual(15, MathUtils.RoundToNearest(21, values));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,30 +137,6 @@ namespace ICD.Common.Utils
|
|||||||
0.0f, 1.0f, new TimeSpan(value.Ticks).TotalSeconds);
|
0.0f, 1.0f, new TimeSpan(value.Ticks).TotalSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the digit count for the given number.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="number"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int GetNumberOfDigits(int number)
|
|
||||||
{
|
|
||||||
int output = number.ToString().Length;
|
|
||||||
if (number < 0)
|
|
||||||
output--;
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the digit count for the given number.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="number"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static int GetNumberOfDigits(uint number)
|
|
||||||
{
|
|
||||||
return number.ToString().Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Takes a sequence of numbers:
|
/// Takes a sequence of numbers:
|
||||||
/// 1, 3, 5, 6, 7, 8, 9, 10, 12
|
/// 1, 3, 5, 6, 7, 8, 9, 10, 12
|
||||||
|
|||||||
Reference in New Issue
Block a user