File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 11namespace Python . Test
22{
3+ using System ;
34 using System . Collections . Generic ;
45
56 /// <summary>
@@ -26,6 +27,8 @@ public ConversionTest()
2627 public ulong UInt64Field = 0 ;
2728 public float SingleField = 0.0F ;
2829 public double DoubleField = 0.0 ;
30+ public IntPtr IntPtrField = IntPtr . Zero ;
31+ public UIntPtr UIntPtrField = UIntPtr . Zero ;
2932 public decimal DecimalField = 0 ;
3033 public string StringField ;
3134 public ShortEnum EnumField ;
@@ -42,7 +45,7 @@ public ConversionTest()
4245
4346 }
4447
45-
48+
4649
4750 public interface ISpam
4851 {
@@ -63,7 +66,7 @@ public string GetValue()
6366 return value ;
6467 }
6568 }
66-
69+
6770 public class UnicodeString
6871 {
6972 public string value = "안녕" ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ def test_bool_conversion():
2525
2626 with pytest .raises (TypeError ):
2727 ob .BooleanField = 1
28-
28+
2929 with pytest .raises (TypeError ):
3030 ob .BooleanField = 0
3131
@@ -679,3 +679,20 @@ def test_iconvertible_conversion():
679679 assert 1024 == change_type (1024 , System .Int32 )
680680 assert 1024 == change_type (1024 , System .Int64 )
681681 assert 1024 == change_type (1024 , System .Int16 )
682+
683+ def test_intptr_conversion ():
684+ from System import IntPtr , UIntPtr , Int64
685+
686+ ob = ConversionTest ()
687+
688+ assert ob .IntPtrField == IntPtr .Zero
689+ assert ob .UIntPtrField == UIntPtr .Zero
690+
691+ ob .IntPtrField = IntPtr (- 1 )
692+ assert ob .IntPtrField == IntPtr (- 1 )
693+
694+ ob .IntPtrField = IntPtr (Int64 (1024 ))
695+ assert ob .IntPtrField == IntPtr (1024 )
696+
697+ ob .UIntPtrField = ob .IntPtrField
698+ assert ob .UIntPtrField == UIntPtr (1024 )
You can’t perform that action at this time.
0 commit comments