-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathPARAMTests.cs
More file actions
122 lines (105 loc) · 5.9 KB
/
Copy pathPARAMTests.cs
File metadata and controls
122 lines (105 loc) · 5.9 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace System.Windows.Forms.Primitives.Tests.Interop;
public class PARAMTests
{
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is32bit))]
public unsafe void FromLowHigh_x32_Result()
{
Assert.Equal(0x03040102, (int)PARAM.FromLowHigh(0x0102, 0x0304));
Assert.Equal(unchecked((int)0xF3F4F1F2), (int)PARAM.FromLowHigh(0xF1F2, 0xF3F4));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is64bit))]
public unsafe void FromLowHigh_x64_Result()
{
Assert.Equal(0x0000000003040102, (long)PARAM.FromLowHigh(0x0102, 0x0304));
Assert.Equal(unchecked((long)0xFFFFFFFFF3F4F1F2), PARAM.FromLowHigh(0xF1F2, 0xF3F4));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is32bit))]
public unsafe void FromLowHighUnsigned_x32_Result()
{
Assert.Equal(0x03040102, (int)PARAM.FromLowHighUnsigned(0x0102, 0x0304));
Assert.Equal(unchecked((int)0xF3F4F1F2), (int)PARAM.FromLowHighUnsigned(0xF1F2, 0xF3F4));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is64bit))]
public unsafe void FromLowHighUnsigned_x64_Result()
{
if (Environment.Is64BitProcess)
{
Assert.Equal(0x0000000003040102, (long)PARAM.FromLowHighUnsigned(0x0102, 0x0304));
Assert.Equal(0x00000000F3F4F1F2, (long)PARAM.FromLowHighUnsigned(0xF1F2, 0xF3F4));
}
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is32bit))]
public unsafe void LOWORD_x32_Result()
{
Assert.Equal(0x0304, PARAM.LOWORD((nint)0x01020304));
Assert.Equal(0xF3F4, PARAM.LOWORD(unchecked((nint)0xF1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is64bit))]
public unsafe void LOWORD_x64_Result()
{
Assert.Equal(0x0304, PARAM.LOWORD(unchecked((nint)0x0506070801020304)));
Assert.Equal(0xF3F4, PARAM.LOWORD(unchecked((nint)0xF5F6F7F8F1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is32bit))]
public unsafe void HIWORD_x32_Result()
{
Assert.Equal(0x0102, PARAM.HIWORD((nint)0x01020304));
Assert.Equal(0xF1F2, PARAM.HIWORD(unchecked((nint)0xF1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is64bit))]
public unsafe void HIWORD_x64_Result()
{
Assert.Equal(0x0102, PARAM.HIWORD(unchecked((nint)0x0506070801020304)));
Assert.Equal(0xF1F2, PARAM.HIWORD(unchecked((nint)0xF5F6F7F8F1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is32bit))]
public unsafe void SignedLOWORD_x32_Result()
{
Assert.Equal(0x0304, PARAM.SignedLOWORD((nint)0x01020304));
Assert.Equal(unchecked((short)0xF3F4), PARAM.SignedLOWORD(unchecked((nint)0xF1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is64bit))]
public unsafe void SignedLOWORD_x64_Result()
{
Assert.Equal(0x0304, PARAM.SignedLOWORD(unchecked((nint)0x0506070801020304)));
Assert.Equal(unchecked((short)0xF3F4), PARAM.SignedLOWORD(unchecked((nint)0xF5F6F7F8F1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is32bit))]
public unsafe void SignedHIWORD_x32_Result()
{
Assert.Equal(0x0102, PARAM.SignedHIWORD((nint)0x01020304));
Assert.Equal(unchecked((short)0xF1F2), PARAM.SignedHIWORD(unchecked((nint)0xF1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is64bit))]
public unsafe void SignedHIWORD_x64_Result()
{
Assert.Equal(0x0102, PARAM.SignedHIWORD(unchecked((nint)0x0506070801020304)));
Assert.Equal(unchecked((short)0xF1F2), PARAM.SignedHIWORD(unchecked((nint)0xF5F6F7F8F1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is32bit))]
public unsafe void ToInt_x32_Result()
{
Assert.Equal(0x01020304, PARAM.ToInt(0x01020304));
Assert.Equal(unchecked((int)0xF1F2F3F4), PARAM.ToInt(unchecked((nint)0xF1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is64bit))]
public unsafe void ToInt_x64_Result()
{
Assert.Equal(0x01020304, PARAM.ToInt(unchecked((nint)0x0506070801020304)));
Assert.Equal(unchecked((int)0xF1F2F3F4), PARAM.ToInt(unchecked((nint)0xF5F6F7F8F1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is32bit))]
public unsafe void ToUInt_x32_Result()
{
Assert.Equal((uint)0x01020304, PARAM.ToUInt(0x01020304));
Assert.Equal(0xF1F2F3F4, PARAM.ToUInt(unchecked((nint)0xF1F2F3F4)));
}
[Fact(Skip = "Condition not met", SkipType = typeof(ArchitectureDetection), SkipUnless = nameof(ArchitectureDetection.Is64bit))]
public unsafe void ToUInt_x64_Result()
{
Assert.Equal((uint)0x01020304, PARAM.ToUInt(unchecked((nint)0x0506070801020304)));
Assert.Equal(0xF1F2F3F4, PARAM.ToUInt(unchecked((nint)0xF5F6F7F8F1F2F3F4)));
}
}