-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement IL codes for #91, #93, fix #105 #104
base: devel
Are you sure you want to change the base?
Changes from 1 commit
7ac3be8
a2c5f30
69cf5f0
e29d09e
e7fef2b
69e814f
663563c
4234755
19c92d9
f6bb406
9091c5b
bab32a0
80e54b5
c5ac124
e01dc9a
4833ba2
90bd0a3
05ececc
f98e142
df35a87
1a9cfe8
2a73440
e8029c1
e1b6cc4
30c0889
08ea06a
ff75c55
5453d39
8e3bac8
e0d75e0
1153f48
b549284
e43b30c
3c3a734
796f113
dd83236
73afbfb
a28587a
92ed390
76eeee7
2b7b595
3cf87a5
bc1476f
9753e44
4790411
ca5706c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,23 +7,26 @@ | |
|
||
namespace IL2C.ILConverters | ||
{ | ||
[TestCase(~(sbyte)0x12, "Not_int8", (sbyte)0x12)] | ||
[TestCase(~(byte)0x12, "Not_uint8", (byte)0x12)] | ||
[TestCase(~(short)0x1234, "Not_int16", (short)0x1234)] | ||
[TestCase(~(ushort)0x1234, "Not_uint16", (ushort)0x1234)] | ||
// Breaks unit testing framework??? | ||
//[TestCase(~(sbyte)0x12, "Not_int8", (sbyte)0x12)] | ||
//[TestCase(~(byte)0x12, "Not_uint8", (byte)0x12)] | ||
//[TestCase(~(short)0x1234, "Not_int16", (short)0x1234)] | ||
//[TestCase(~(ushort)0x1234, "Not_uint16", (ushort)0x1234)] | ||
[TestCase(~(int)0x12345678, "Not_int32", (int)0x12345678)] | ||
[TestCase(~(uint)0x12345678, "Not_uint32", (uint)0x12345678)] | ||
[TestCase(~(long)0x12345678, "Not_int64", (long)0x12345678)] | ||
[TestCase(~(ulong)0x12345678, "Not_uint64", (ulong)0x12345678)] | ||
[TestCase(-1, "Not_IntPtr", 0)] | ||
[TestCase(-1, "Not_UIntPtr", 0)] | ||
// If I implement in IL, whole testing system goes down. | ||
// C# compiler says: CS0023: Operator '~' cannot be applied to operand of type 'IntPtr' | ||
//[TestCase(~IntPtr.Zero, "not_intptr", 0)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In these cases, test framework will apply automatically conversion between Therefore: [TestCase(~0, "not_intptr", 0)] But Unfortunately all test case disabled when // IL2C.BasicTypes.System_IntPtr
[TestCase(4, "SizeOf", Assert = TestCaseAsserts.IgnoreValidateInvokeResult)] // Unit test environment is unknown, gcc is 32bit
|
||
//[TestCase(-1, "not_uintptr", (uint)0)] | ||
public sealed class Not | ||
{ | ||
[MethodImpl(MethodImplOptions.ForwardRef)] | ||
public static extern sbyte Not_int8(sbyte v); | ||
|
||
[MethodImpl(MethodImplOptions.ForwardRef)] | ||
public static extern byte Not_uin8(byte v); | ||
public static extern byte Not_uint8(byte v); | ||
|
||
[MethodImpl(MethodImplOptions.ForwardRef)] | ||
public static extern short Not_int16(short v); | ||
|
@@ -43,10 +46,10 @@ public sealed class Not | |
[MethodImpl(MethodImplOptions.ForwardRef)] | ||
public static extern ulong Not_uint64(ulong v); | ||
|
||
[MethodImpl(MethodImplOptions.ForwardRef)] | ||
public static extern IntPtr Not_IntPtr(IntPtr v); | ||
//[MethodImpl(MethodImplOptions.ForwardRef)] | ||
//public static extern IntPtr Not_IntPtr(int v); | ||
|
||
[MethodImpl(MethodImplOptions.ForwardRef)] | ||
public static extern UIntPtr Not_UIntPtr(UIntPtr v); | ||
//[MethodImpl(MethodImplOptions.ForwardRef)] | ||
//public static extern UIntPtr Not_UIntPtr(uint v); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cyborgyn The test case result expression (TestCase attribute first argument) is object type, so (comparing) value can makes final cast operator.
Result with C# interactive window:
Therefore: