Skip to content

Commit

Permalink
Deconstruct kvp
Browse files Browse the repository at this point in the history
  • Loading branch information
cinderblocks committed Jun 30, 2024
1 parent aa713bc commit dfb296c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions LibreMetaverse.Tests/TypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,8 @@ public void VectorCasting()
testNumbers["1.0000001"] = 1.0000001;
testNumbers["1.00000001"] = 1.00000001;

foreach (KeyValuePair<string, double> kvp in testNumbers)
foreach (var (key, testNumber) in testNumbers)
{
double testNumber = kvp.Value;
double testNumber2 = (double)((float)testNumber);
bool noPrecisionLoss = testNumber == testNumber2;

Expand All @@ -131,24 +130,24 @@ public void VectorCasting()
{
Console.Error.WriteLine("Unsuitable test value used-" +
" test number should have precision loss when" +
" cast to float ({0}).", kvp.Key);
" cast to float ({0}).", key);
}
else
{
Assert.IsFalse(a == b,
"Vector casting failed, precision loss should" + " have occurred. " +
$"{kvp.Key}: {a.X}, {b.X}");
$"{key}: {a.X}, {b.X}");
Assert.IsFalse(b == d,
"Vector casting failed, explicit cast of double" + " to float should result in precision loss" +
" whichwas should not magically disappear when" + " Vector3 is implicitly cast to Vector3d." +
$" {kvp.Key}: {b.X}, {d.X}");
$" {key}: {b.X}, {d.X}");
}
Assert.IsTrue(a == c,
"Vector casting failed, Vector3 compared to" + " explicit cast of Vector3d to Vector3 should" +
" result in identical precision loss." + $" {kvp.Key}: {a.X}, {c.X}");
" result in identical precision loss." + $" {key}: {a.X}, {c.X}");
Assert.IsTrue(a == d,
"Vector casting failed, implicit cast of Vector3" +
" to Vector3d should not result in precision loss." + $" {kvp.Key}: {a.X}, {d.X}");
" to Vector3d should not result in precision loss." + $" {key}: {a.X}, {d.X}");
}
}

Expand Down

0 comments on commit dfb296c

Please sign in to comment.