mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-10 03:45:41 +00:00
[ci skip] Use explicit type in tests
This commit is contained in:
parent
928fa64ba4
commit
2128814db1
@ -1,4 +1,4 @@
|
|||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
|
||||||
namespace X10D.Tests.Core
|
namespace X10D.Tests.Core
|
||||||
{
|
{
|
||||||
@ -20,8 +20,11 @@ namespace X10D.Tests.Core
|
|||||||
var trueBytes = new byte[] { 0x01 };
|
var trueBytes = new byte[] { 0x01 };
|
||||||
var falseBytes = new byte[] { 0x00 };
|
var falseBytes = new byte[] { 0x00 };
|
||||||
|
|
||||||
var trueResult = trueValue.GetBytes();
|
byte[] trueResult = trueValue.GetBytes();
|
||||||
var falseResult = falseValue.GetBytes();
|
byte[] falseResult = falseValue.GetBytes();
|
||||||
|
|
||||||
|
Assert.AreEqual(1, trueResult.Length);
|
||||||
|
Assert.AreEqual(1, trueResult.Length);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(trueBytes, trueResult);
|
CollectionAssert.AreEqual(trueBytes, trueResult);
|
||||||
CollectionAssert.AreEqual(falseBytes, falseResult);
|
CollectionAssert.AreEqual(falseBytes, falseResult);
|
||||||
|
@ -15,7 +15,7 @@ namespace X10D.Tests.Core
|
|||||||
const int repeatCount = 10;
|
const int repeatCount = 10;
|
||||||
|
|
||||||
const string repeated = "aaaaaaaaaa";
|
const string repeated = "aaaaaaaaaa";
|
||||||
var result = character.Repeat(repeatCount);
|
string result = character.Repeat(repeatCount);
|
||||||
|
|
||||||
Assert.AreEqual(repeated, result);
|
Assert.AreEqual(repeated, result);
|
||||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => character.Repeat(-1));
|
Assert.ThrowsException<ArgumentOutOfRangeException>(() => character.Repeat(-1));
|
||||||
|
@ -35,8 +35,8 @@ namespace X10D.Tests.Core
|
|||||||
{
|
{
|
||||||
for (var index = 0; index < _primeNumbers.Count; index++)
|
for (var index = 0; index < _primeNumbers.Count; index++)
|
||||||
{
|
{
|
||||||
var value = _primeNumbers[index];
|
int value = _primeNumbers[index];
|
||||||
var result = value.IsPrime();
|
bool result = value.IsPrime();
|
||||||
Assert.IsTrue(result, value.ToString("N0", CultureInfo.InvariantCulture));
|
Assert.IsTrue(result, value.ToString("N0", CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ namespace X10D.Tests.Core
|
|||||||
{
|
{
|
||||||
for (var value = short.MinValue; value < 0; value++)
|
for (var value = short.MinValue; value < 0; value++)
|
||||||
{
|
{
|
||||||
var result = value.IsPrime();
|
bool result = value.IsPrime();
|
||||||
Assert.IsFalse(result, value.ToString("N0", CultureInfo.InvariantCulture));
|
Assert.IsFalse(result, value.ToString("N0", CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ namespace X10D.Tests.Core
|
|||||||
{
|
{
|
||||||
for (var value = 0; value < 2; value++)
|
for (var value = 0; value < 2; value++)
|
||||||
{
|
{
|
||||||
var result = value.IsPrime();
|
bool result = value.IsPrime();
|
||||||
Assert.IsFalse(result, value.ToString("N0", CultureInfo.InvariantCulture));
|
Assert.IsFalse(result, value.ToString("N0", CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,8 +75,8 @@ namespace X10D.Tests.Core
|
|||||||
{
|
{
|
||||||
for (var value = 0; value < 7920; value++)
|
for (var value = 0; value < 7920; value++)
|
||||||
{
|
{
|
||||||
var expected = _primeNumbers.Contains(value);
|
bool expected = _primeNumbers.Contains(value);
|
||||||
var actual = value.IsPrime();
|
bool actual = value.IsPrime();
|
||||||
|
|
||||||
Assert.AreEqual(expected, actual, value.ToString("N0", CultureInfo.InvariantCulture));
|
Assert.AreEqual(expected, actual, value.ToString("N0", CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
@ -90,8 +90,8 @@ namespace X10D.Tests.Core
|
|||||||
{
|
{
|
||||||
for (byte value = 0; value < byte.MaxValue; value++)
|
for (byte value = 0; value < byte.MaxValue; value++)
|
||||||
{
|
{
|
||||||
var expected = _primeNumbers.Contains(value);
|
bool expected = _primeNumbers.Contains(value);
|
||||||
var actual = value.IsPrime();
|
bool actual = value.IsPrime();
|
||||||
|
|
||||||
Assert.AreEqual(expected, actual, value.ToString("N0", CultureInfo.InvariantCulture));
|
Assert.AreEqual(expected, actual, value.ToString("N0", CultureInfo.InvariantCulture));
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ namespace X10D.Tests.Core
|
|||||||
|
|
||||||
while (reader.ReadLine() is { } line)
|
while (reader.ReadLine() is { } line)
|
||||||
{
|
{
|
||||||
if (int.TryParse(line, out var prime))
|
if (int.TryParse(line, out int prime))
|
||||||
{
|
{
|
||||||
primes.Add(prime);
|
primes.Add(prime);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user