Skip to content

Commit

Permalink
add sort test for Fixed8
Browse files Browse the repository at this point in the history
  • Loading branch information
erikzhang committed Nov 7, 2018
1 parent 2b1ba1c commit 07b9a44
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions neo.UnitTests/UT_Fixed8.cs
@@ -1,4 +1,5 @@
using System;
using System.Linq;
using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;

Expand Down Expand Up @@ -46,5 +47,26 @@ public void Can_multiply_without_overflow()
Fixed8 actual = af * bf;
((decimal)actual).Should().Be(expected);
}

[TestMethod]
public void Sort()
{
Fixed8[] numbers = new[]
{
Fixed8.FromDecimal(5),
Fixed8.FromDecimal(7),
Fixed8.FromDecimal(2),
Fixed8.FromDecimal(4),
Fixed8.FromDecimal(1),
Fixed8.FromDecimal(8),
Fixed8.FromDecimal(9),
Fixed8.FromDecimal(0),
Fixed8.FromDecimal(3),
Fixed8.FromDecimal(6)
};
numbers = numbers.OrderBy(p => p).ToArray();
for (int i = 0; i < numbers.Length; i++)
numbers[i].Should().Be(Fixed8.FromDecimal(i));
}
}
}

1 comment on commit 07b9a44

@igormcoelho
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important test! Congratulations!

Please sign in to comment.