forked from ReClassNET/ReClass.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntPtrComparerTest.cs
More file actions
29 lines (26 loc) · 841 Bytes
/
Copy pathIntPtrComparerTest.cs
File metadata and controls
29 lines (26 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System;
using NFluent;
using ReClassNET.Util;
using Xunit;
namespace ReClass.NET_Tests.Util
{
public class IntPtrComparerTest
{
public static TheoryData<IntPtr, IntPtr, bool> GetTestCompareData() => new TheoryData<IntPtr, IntPtr, bool>
{
{ IntPtr.Zero, IntPtr.Zero, false },
{ (IntPtr)0x1, IntPtr.Zero, false },
{ (IntPtr)0x1, (IntPtr)0x10, true },
{ (IntPtr)0x1, unchecked((IntPtr)(int)0xFFFFFFFF), true },
{ unchecked((IntPtr)(int)0xFFFFFFFF), unchecked((IntPtr)(int)0xFFFFFFFF), false },
{ unchecked((IntPtr)(int)0xFFFFFFFF), IntPtr.Zero, false }
};
[Theory]
[MemberData(nameof(GetTestCompareData))]
public void TestCompare(IntPtr lhs, IntPtr rhs, bool lhsIsSmaller)
{
var comparer = IntPtrComparer.Instance;
Check.That(comparer.Compare(lhs, rhs) < 0).IsEqualTo(lhsIsSmaller);
}
}
}