2 using System
.Collections
.Generic
;
4 using System
.Reflection
;
6 // Dynamic binary operator, unary operators and convert tests
8 public struct InverseLogicalOperator
11 public InverseLogicalOperator (bool value)
16 public static bool operator true (InverseLogicalOperator u
)
21 public static bool operator false (InverseLogicalOperator u
)
31 public MyType (int value) : this ()
36 public short ShortProp { get; set; }
38 public override int GetHashCode ()
40 throw new NotImplementedException ();
43 public static bool operator true (MyType a
)
48 public static bool operator false (MyType a
)
53 public static MyType
operator + (MyType a
, MyType b
)
55 return new MyType (a
.value + b
.value);
58 public static MyType
operator - (MyType a
, MyType b
)
60 return new MyType (a
.value - b
.value);
63 public static MyType
operator / (MyType a
, MyType b
)
65 return new MyType (a
.value / b
.value);
68 public static MyType
operator * (MyType a
, MyType b
)
70 return new MyType (a
.value * b
.value);
73 public static MyType
operator % (MyType a
, MyType b
)
75 return new MyType (a
.value % b
.value);
78 public static MyType
operator &(MyType a
, MyType b
)
80 return new MyType (a
.value & b
.value);
83 public static MyType
operator | (MyType a
, MyType b
)
85 return new MyType (a
.value | b
.value);
88 public static MyType
operator ^
(MyType a
, MyType b
)
90 return new MyType (a
.value ^ b
.value);
93 public static bool operator == (MyType a
, MyType b
)
95 return a
.value == b
.value;
98 public static bool operator != (MyType a
, MyType b
)
100 return a
.value != b
.value;
103 public static bool operator > (MyType a
, MyType b
)
105 return a
.value > b
.value;
108 public static bool operator < (MyType a
, MyType b
)
110 return a
.value < b
.value;
113 public static bool operator >= (MyType a
, MyType b
)
115 return a
.value >= b
.value;
118 public static bool operator <= (MyType a
, MyType b
)
120 return a
.value <= b
.value;
123 public static bool operator ! (MyType a
)
128 public static int operator ~
(MyType a
)
133 public static MyType
operator ++ (MyType a
)
135 return new MyType (a
.value * 2);
138 public static MyType
operator -- (MyType a
)
140 return new MyType (a
.value / 2);
143 public static int operator >> (MyType a
, int b
)
148 public static int operator << (MyType a
, int b
)
153 public static MyType
operator - (MyType a
)
155 return new MyType (-a
.value);
158 public static MyType
operator + (MyType a
)
160 return new MyType (334455); // magic number
163 public override string ToString ()
165 return value.ToString ();
174 public MyTypeExplicit (int value)
179 public static explicit operator int (MyTypeExplicit m
)
185 struct MyTypeImplicitOnly
189 public MyTypeImplicitOnly (short b
)
194 public static implicit operator short (MyTypeImplicitOnly m
)
199 public static implicit operator bool (MyTypeImplicitOnly m
)
211 enum MyEnumUlong
: ulong
220 delegate void EmptyDelegate ();
221 event Action ev_assign
;
223 static void Assert
<T
> (T expected
, T
value, string name
)
225 if (!EqualityComparer
<T
>.Default
.Equals (expected
, value)) {
227 throw new ApplicationException (name
+ expected
+ " != " + value);
231 static void AssertChecked
<T
> (Func
<T
> expected
, T
value, string name
)
234 Assert (expected (), value, name
);
235 throw new ApplicationException (name
+ ": OverflowException expected");
236 } catch (OverflowException
) {
241 static void AssertChecked (Action expected
, string name
)
245 throw new ApplicationException (name
+ ": OverflowException expected");
246 } catch (OverflowException
) {
251 #pragma warning disable 169
258 Assert (d
+ v
, 7, "#1");
260 Assert (d
+ v2
, 5.5, "#1a");
263 MyType v3
= new MyType (30);
264 Assert (d
+ v3
, new MyType (35), "#3");
265 dynamic d3
= new MyType (-7);
266 Assert
<MyType
> (d3
+ new MyType (6), new MyType (-1), "#3a");
268 d3
= new MyTypeImplicitOnly (6);
269 Assert (d3
+ new MyTypeImplicitOnly (11), 17, "#3b");
271 d
= new MyTypeImplicitOnly (5);
273 Assert (d
+ v4
, 9m
, "#4");
276 void AddNullableTest ()
281 Assert
<int?> (d
+ v2
, null, "#1");
282 Assert
<int?> (d
+ null, null, "#1a");
283 Assert
<int?> (null + d
, null, "#1b");
286 Assert (d
+ v2
, 3, "#2");
287 dynamic d2
= (int?) -2;
288 Assert (d2
+ 1, -1, "#2a");
291 MyType
? v3
= new MyType (30);
292 Assert (d
+ v3
, new MyType (35), "#3");
293 dynamic d3
= new MyType
? (new MyType (-7));
294 Assert (d3
+ new MyType (6), new MyType (-1), "#3a");
295 Assert
<MyType
?> (d3
+ null, null, "#3b");
297 d
= new MyTypeImplicitOnly (5);
299 Assert (d
+ v4
, 9m
, "#4");
301 Assert
<decimal?> (d
+ v4
, null, "#4a");
306 dynamic d
= MyEnum
.Value_1
;
308 Assert (d
+ 1, MyEnum
.Value_2
, "#1");
310 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_1
;
311 Assert (d2
+ (byte) 1, MyEnumUlong
.Value_2
, "#2");
312 Assert
<MyEnumUlong
?> (d2
+ null, null, "#2a");
314 // CSC: Invalid System.InvalidOperationException
315 Assert
<MyEnum
?> (d
+ null, null, "#1");
318 void AddCheckedTest ()
323 int v
= int.MaxValue
;
324 AssertChecked (() => d
+ v
, 7, "#1");
327 AssertChecked (() => d
+ v2
, null, "#2");
330 MyType v3
= new MyType (int.MaxValue
);
331 Assert (new MyType (-2147483646), d
+ v3
, "#3");
335 void AddStringTest ()
339 Assert (d
+ v
, "foo->", "#1");
340 Assert (d
+ 1, "foo1", "#1a");
341 Assert (d
+ null, "foo", "#1b");
342 Assert (d
+ 1 + v
, "foo1->", "#1a");
345 Assert (d
+ v2
, "foo4", "#2");
348 void AddAssignTest ()
359 Assert (d
, 5.5, "#1a");
361 Assert (d
, 7.5, "#1b");
363 dynamic d3
= new MyType (-7);
364 d3
+= new MyType (6);
365 Assert
<MyType
> (d3
, new MyType (-1), "#3");
370 Assert (d
, 9m
, "#4");
373 void AddAssignNullableTest ()
375 dynamic d
= (int?) 5;
378 // For now it's impossible to use nullable compound assignment
379 // due to the way how DLR works. GetType () on nullable object returns
380 // underlying type and not nullable type, that means that
381 // C# binder is initialized with wrong operand type and any operation
386 Assert<int?> (d, null, "#1");
388 Assert<int?> (d, null, "#1a");
397 Assert (d, -1, "#2a");
399 MyType? v3 = new MyType (30);
401 Assert (d, new MyType (35), "#3");
402 dynamic d3 = new MyType? (new MyType (-7));
403 Assert (d3 + new MyType (6), new MyType (-1), "#3a");
404 Assert<MyType?> (d3 + null, null, "#3b");
409 Assert (d, 9m, "#4");
411 Assert<decimal?> (d, null, "#4a");
415 void AddAssignEnumTest ()
417 dynamic d
= MyEnum
.Value_1
;
421 Assert (d
, MyEnum
.Value_2
, "#2");
423 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_1
;
425 Assert (d2
, MyEnumUlong
.Value_2
, "#3");
428 void AddAssignCheckedTest ()
433 int v
= int.MaxValue
;
434 AssertChecked (() => { d += v; Assert (d, 0, "#1-"); }
, "#1");
437 MyType v3
= new MyType (int.MaxValue
);
439 Assert (d
, new MyType (-2147483644), "#3-");
443 void AddAssignStringTest ()
448 Assert (d
, "foo->", "#1");
452 Assert (d
, "foo1", "#1a");
455 Assert (d
, "foo1", "#1b");
460 Assert (d
, "foo4", "#2");
463 void AddAssignEvent ()
467 // FIXME: Will have to special case events
476 Assert (d
& v
, false, "#1");
477 Assert (d
& true, true, "#1a");
481 Assert (d
& v2
, 42, "#2");
482 Assert (d
& 0, 0, "#2a");
485 MyType v3
= new MyType (30);
486 Assert (d
& v3
, new MyType (10), "#3");
487 dynamic d3
= new MyType (-7);
488 Assert
<MyType
> (d3
& new MyType (6), new MyType (0), "#3a");
490 d3
= new MyTypeImplicitOnly (6);
491 Assert (d3
& 11, 2, "#3b");
496 dynamic d
= MyEnum
.Value_1
;
498 Assert
<MyEnum
?> (d
& null, null, "#1");
500 Assert (d
& d
, MyEnum
.Value_1
, "#2");
502 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_1
;
503 Assert
<MyEnumUlong
> (d2
& MyEnumUlong
.Value_2
, 0, "#3");
506 void AndTestNullable ()
511 Assert
<int?> (d
& v2
, null, "#1");
512 Assert
<int?> (d
& null, null, "#1a");
513 Assert
<int?> (null & d
, null, "#1b");
516 Assert (d
& v2
, 4, "#2");
517 dynamic d2
= (int?) -2;
518 Assert (d2
& 1, 0, "#2a");
521 MyType
? v3
= new MyType (30);
522 Assert (d
& v3
, new MyType (22), "#3");
523 dynamic d3
= new MyType
? (new MyType (-7));
524 Assert (d3
& new MyType (6), new MyType (0), "#3a");
525 Assert
<MyType
?> (d3
+ null, null, "#3b");
527 dynamic a
= (bool?) true;
528 dynamic b
= (bool?) null;
529 Assert (a
& b
, (bool?)null, "#4a");
530 Assert (b
& a
, (bool?)null, "#4b");
533 void AndAssignedTest ()
539 Assert (d
, false, "#1");
542 Assert (d
, true, "#1a");
547 Assert (d
, 42, "#2");
549 MyType v3
= new MyType (30);
550 dynamic d3
= new MyType (-7);
551 d3
&= new MyType (6);
552 Assert
<MyType
> (d3
, new MyType (0), "#3");
555 void AndAssignedTestEnum ()
557 dynamic d
= MyEnum
.Value_1
;
559 Assert
<MyEnum
>(d
, 0, "#1");
563 Assert (d
, MyEnum
.Value_2
, "#2");
565 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_1
;
566 Assert
<MyEnumUlong
> (d2
& MyEnumUlong
.Value_2
, 0, "#3");
574 Assert
<bool> (d
&& v
, false, "#1");
576 Assert (d
&& true, true, "#1a");
579 Assert (d
&& d
, true, "#2");
581 dynamic d3
= new MyType (-7);
582 Assert
<MyType
> (d3
&& new MyType (6), new MyType (0), "#3");
590 Assert (d
/ v
, 2, "#1");
593 MyType v3
= new MyType (30);
594 Assert (d
/ v3
, new MyType (0), "#3");
595 dynamic d3
= new MyType (-7);
596 Assert
<MyType
> (d3
+ new MyType (6), new MyType (-1), "#3a");
598 d
= new MyTypeImplicitOnly (6);
600 Assert (d
/ v4
, 1.5m
, "#4");
603 void DivideNullableTest ()
608 Assert
<double?> (d
/ v2
, null, "#1");
609 Assert
<double?> (d
/ null, null, "#1a");
610 Assert
<double?> (null / d
, null, "#1b");
613 Assert (d
/ v2
, -2.5, "#2");
614 dynamic d2
= (int?) -2;
615 Assert (d2
/ 1, -2, "#2a");
618 MyType
? v3
= new MyType (30);
619 Assert (d
/ v3
, new MyType (0), "#3");
620 dynamic d3
= new MyType
? (new MyType (-7));
621 Assert (d3
/ new MyType (6), new MyType (-1), "#3a");
622 Assert
<MyType
?> (d3
+ null, null, "#3b");
624 d
= new MyTypeImplicitOnly (5);
626 Assert (d
/ v4
, 1.25m
, "#4");
628 Assert
<decimal?> (d
/ v4
, null, "#4a");
631 void DivideCheckedTest ()
638 void DivideAssignTest ()
649 Assert (d
, 10, "#1a");
651 Assert (d
, 5, "#1b");
653 dynamic d3
= new MyType (-7);
654 d3
/= new MyType (6);
655 Assert
<MyType
> (d3
, new MyType (-1), "#3");
660 Assert (d
, 1.25m
, "#4");
663 void DivideAssignCheckedTest ()
670 void ConvertImplicitTest ()
674 Assert (3m
, v1
, "#1");
676 d
= new MyTypeImplicitOnly (5);
678 Assert (5, v2
, "#2");
682 Assert (4, v3
, "#3");
684 int[] v4
= new int[] { d }
;
685 Assert (4, v4
[0], "#4");
688 var v5
= new [] { d, 1 }
;
689 Assert (true, v5
[0], "#5");
690 Assert (1, v5
[1], "#5a");
694 var r
= b
? d
: "ss";
695 Assert ("ss", r
, "#6");
697 var v
= new [] { d, 1 }
;
698 Assert ("aa", v
[0], "#7");
700 dynamic [,] a
= new dynamic [,] { { 1, 2 }
, { 'b', 'x' }
};
701 Assert (2, a
[0, 1], "#8");
702 Assert ('x', a
[1, 1], "#8a");
705 int ConvertImplicitReturnTest ()
707 dynamic d
= (byte) 3;
711 IEnumerable
<string> ConvertImplicitReturnTest_2 ()
717 void ConvertExplicitTest ()
720 Assert (44, (byte) d
, "#1");
721 Assert
<byte?> (44, (byte?) d
, "#1a");
726 d
= new MyTypeImplicitOnly (5);
727 Assert (5, (int) d
, "#3");
729 d
= new MyTypeExplicit (-2);
730 Assert (-2, (int) d
, "#4");
733 Assert (null, (object) d
, "#5");
736 void ConvertExplicitCheckedTest ()
740 AssertChecked (() => (byte) d
, 7, "#1");
743 AssertChecked
<uint?> (() => (uint?) d
, 2, "#2");
749 dynamic idx
= (uint) 1;
750 var arr
= new int [5];
752 Assert (2, arr
[idx
], "#1");
760 Assert (d
== v
, false, "#1");
762 Assert (d
== v2
, true, "#1a");
765 Assert (d
== false, false, "#2");
767 Assert (d
== b2
, true, "#2a");
770 MyType v3
= new MyType (30);
771 Assert (d
== v3
, true, "#3");
772 dynamic d3
= new MyTypeImplicitOnly (-7);
773 Assert (d3
== 11, false, "#3b");
777 Assert (d
== v4
, false, "#4");
778 Assert (d
== 2m
, true, "#4a");
781 Assert (d
== null, true, "#5");
784 void EqualNullableTest ()
789 Assert (d
== v2
, false, "#1");
790 Assert (d
== null, false, "#1a");
791 Assert (null == d
, false, "#1b");
794 Assert (d
== v2
, false, "#2");
795 dynamic d2
= (int?) -2;
796 Assert (d2
== 1, false, "#2a");
798 Assert (d2
== 44, true, "#2b");
801 MyType
? v3
= new MyType (30);
802 Assert (d
== v3
, true, "#3");
803 dynamic d3
= new MyType
? (new MyType (-7));
804 Assert (d3
== new MyType (6), false, "#3a");
805 Assert (d3
== null, false, "#3b");
809 Assert (d
== v4
, false, "#4");
811 Assert (d
== v4
, false, "#4a");
814 Assert (d
== true, true, "#5");
815 Assert (d
== null, false, "#5a");
816 Assert (d
== false, false, "#5b");
819 void EqualEnumTest ()
821 dynamic d
= MyEnum
.Value_1
;
823 Assert (d
== null, false, "#1");
825 Assert (d
== MyEnum
.Value_1
, true, "#2");
826 Assert (d
== 0, false, "#2a");
828 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_2
;
829 Assert (d2
== MyEnumUlong
.Value_2
, true, "#3");
830 Assert (d2
== null, false, "#3a");
833 void EqualStringTest ()
837 Assert (d
== "te", false, "#1");
838 Assert (d
== "text", true, "#1a");
839 Assert (d
== null, false, "#1b");
842 void EqualDelegateTest ()
846 // Assert (d == delegate { }, true, "#1");
848 EmptyDelegate b
= EqualDelegateTest
;
851 //Assert (d == EqualDelegateTest, true, "#2");
855 void EqualTestDelegate_2 ()
857 EmptyDelegate ed = delegate () {};
859 Expression<Func<EmptyDelegate, EmptyDelegate, bool>> e2 = (a, b) => a == b;
860 AssertNodeType (e2, ExpressionType.Equal);
861 Assert (false, e2.Compile ().Invoke (delegate () {}, null));
862 Assert (false, e2.Compile ().Invoke (delegate () {}, delegate {}));
863 Assert (false, e2.Compile ().Invoke (ed, delegate {}));
864 Assert (true, e2.Compile ().Invoke (ed, ed));
868 void ExclusiveOrTest ()
873 Assert (d ^ v
, true, "#1");
874 Assert (d ^
true, false, "#1a");
878 Assert (d ^ v2
, 20, "#2");
879 Assert (d ^
0, 42, "#2a");
882 MyType v3
= new MyType (30);
883 Assert (d ^ v3
, new MyType (52), "#3");
884 dynamic d3
= new MyType (-7);
885 Assert
<MyType
> (d3 ^
new MyType (6), new MyType (-1), "#3a");
887 d3
= new MyTypeImplicitOnly (-7);
888 Assert (d3 ^
11, -14, "#3b");
891 void ExclusiveOrNullableTest ()
896 Assert
<int?> (d ^ v2
, null, "#1");
897 Assert
<int?> (d ^
null, null, "#1a");
898 Assert
<int?> (null ^ d
, null, "#1b");
901 Assert (d ^ v2
, -5, "#2");
902 dynamic d2
= (int?) -2;
903 Assert (d2 ^
1, -1, "#2a");
906 MyType
? v3
= new MyType (30);
907 Assert (d ^ v3
, new MyType (27), "#3");
908 dynamic d3
= new MyType
? (new MyType (-7));
909 Assert (d3 ^
new MyType (6), new MyType (-1), "#3a");
910 Assert
<MyType
?> (d3 ^
null, null, "#3b");
913 void ExclusiveOrTestEnum ()
915 dynamic d
= MyEnum
.Value_1
;
917 Assert
<MyEnum
?> (d ^
null, null, "#1");
919 Assert
<MyEnum
> (d ^ d
, 0, "#2");
921 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_1
;
922 Assert
<MyEnumUlong
> (d2 ^ MyEnumUlong
.Value_2
, (MyEnumUlong
) 3, "#3");
925 void ExclusiveOrAssignedTest ()
931 Assert (d
, true, "#1");
934 Assert (d
, false, "#1a");
939 Assert (d
, 20, "#2");
941 MyType v3
= new MyType (30);
942 dynamic d3
= new MyType (-7);
943 d3 ^
= new MyType (6);
944 Assert (d3
, new MyType (-1), "#3");
947 void ExclusiveOrAssignedTestEnum ()
949 dynamic d
= MyEnum
.Value_1
;
951 Assert
<MyEnum
>(d
, (MyEnum
) 3, "#1");
955 Assert
<MyEnum
> (d
, 0, "#2");
957 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_1
;
958 Assert (d2 ^ MyEnumUlong
.Value_2
, (MyEnumUlong
)3, "#3");
961 void GreaterThanTest ()
966 Assert (d
> v
, true, "#1");
968 Assert (d
> v2
, false, "#1a");
971 Assert (d
> 4.59, true, "#2");
973 Assert (d
> b2
, false, "#2a");
976 MyType v3
= new MyType (30);
977 Assert (d
> v3
, false, "#3");
978 dynamic d3
= new MyType (-7);
979 Assert (d3
> new MyType (6), false, "#3a");
981 d3
= new MyTypeImplicitOnly (-7);
982 Assert (d3
> 11, false, "#3b");
986 Assert (d
> v4
, false, "#4");
987 Assert (d
> 2m
, false, "#4a");
990 void GreaterThanNullableTest ()
995 Assert (d
> v2
, false, "#1");
996 Assert (d
> null, false, "#1a");
997 Assert (null > d
, false, "#1b");
1000 Assert (d
> v2
, true, "#2");
1001 dynamic d2
= (int?) -2;
1002 Assert (d2
> 1, false, "#2a");
1004 Assert (d2
> 44, false, "#2b");
1006 d
= new MyType (30);
1007 MyType
? v3
= new MyType (30);
1008 Assert (d
> v3
, false, "#3");
1009 dynamic d3
= new MyType
? (new MyType (-7));
1010 Assert (d3
> new MyType (6), false, "#3a");
1011 Assert (d3
> null, false, "#3b");
1015 Assert (d
> v4
, true, "#4");
1017 Assert (d
> v4
, false, "#4a");
1020 void GreaterThanEnumTest ()
1022 dynamic d
= MyEnum
.Value_1
;
1024 Assert (d
> null, false, "#1");
1026 Assert (d
> MyEnum
.Value_1
, false, "#2");
1027 Assert (d
> 0, true, "#2a");
1029 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_2
;
1030 Assert (d2
> MyEnumUlong
.Value_2
, false, "#3");
1031 Assert (d2
> null, false, "#3a");
1034 void GreaterThanEqualTest ()
1039 Assert (d
>= v
, true, "#1");
1041 Assert (d
>= v2
, true, "#1a");
1044 Assert (d
>= 4.59, true, "#2");
1046 Assert (d
>= b2
, true, "#2a");
1048 d
= new MyType (30);
1049 MyType v3
= new MyType (30);
1050 Assert (d
>= v3
, true, "#3");
1051 dynamic d3
= new MyType (-7);
1052 Assert (d3
>= new MyType (6), false, "#3a");
1054 d3
= new MyTypeImplicitOnly (-7);
1055 Assert (d3
>= 11, false, "#3b");
1059 Assert (d
>= v4
, false, "#4");
1060 Assert (d
>= 2m
, true, "#4a");
1063 void GreaterThanEqualNullableTest ()
1068 Assert (d
>= v2
, false, "#1");
1069 Assert (d
>= null, false, "#1a");
1070 Assert (null >= d
, false, "#1b");
1073 Assert (d
>= v2
, true, "#2");
1074 dynamic d2
= (int?) -2;
1075 Assert (d2
>= 1, false, "#2a");
1077 Assert (d2
>= 44, true, "#2b");
1079 d
= new MyType (30);
1080 MyType
? v3
= new MyType (30);
1081 Assert (d
>= v3
, true, "#3");
1082 dynamic d3
= new MyType
? (new MyType (-7));
1083 Assert (d3
>= new MyType (6), false, "#3a");
1084 Assert (d3
>= null, false, "#3b");
1088 Assert (d
>= v4
, true, "#4");
1090 Assert (d
>= v4
, false, "#4a");
1093 void GreaterThanEqualEnumTest ()
1095 dynamic d
= MyEnum
.Value_1
;
1097 Assert (d
>= null, false, "#1");
1099 Assert (d
>= MyEnum
.Value_1
, true, "#2");
1100 Assert (d
>= 0, true, "#2a");
1102 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_2
;
1103 Assert (d2
>= MyEnumUlong
.Value_2
, true, "#3");
1104 Assert (d2
>= null, false, "#3a");
1110 Assert (d
is long, false, "#1");
1111 Assert (d
is int, true, "#2");
1112 Assert (d
is string, false, "#3");
1115 void LeftShiftTest ()
1117 dynamic d
= (ulong) 0x7F000;
1120 Assert
<ulong> (d
<< v
, 0x1FC000, "#1");
1121 Assert
<ulong> (d
<< 1, 0xFE000, "#1a");
1123 Assert
<ulong> (d
<< s
, 0x1FC000, "#1b");
1126 MyTypeImplicitOnly v3
= new MyTypeImplicitOnly (3);
1127 Assert (d
<< v3
, 0x3F8000, "#3");
1128 dynamic d3
= new MyType (-7);
1129 Assert (d3
<< new MyTypeImplicitOnly (6), -448, "#3a");
1130 Assert (d3
<< 11, -14336, "#3b");
1133 void LeftShiftNullableTest ()
1138 Assert
<int?> (d
<< v2
, null, "#1");
1140 Assert
<int?> (d
<< null, null, "#1a");
1142 Assert
<int?> (null << d
, null, "#1b");
1145 Assert (d
<< v2
, 0x40000000, "#2");
1146 dynamic d2
= (int?) -2;
1147 Assert (d2
<< 1, -4, "#2a");
1149 dynamic d3
= (int?) null;
1150 Assert (d3
<< (null << null), (int?)null, "#3");
1153 void LeftShiftAssignTest ()
1155 dynamic d
= 0x7F000;
1159 Assert (d
, 0x1FC000, "#1");
1161 Assert (d
, 0x3F8000, "#1a");
1164 Assert (d
, 0xFE0000, "#1b");
1167 void LeftShiftAssignNullableTest ()
1173 Assert (d
, 0x40000000, "#2");
1174 dynamic d2
= (int?) -2;
1176 Assert (d2
, -4, "#2a");
1179 void LessThanTest ()
1184 Assert (d
< v
, false, "#1");
1186 Assert (d
< v2
, false, "#1a");
1189 Assert (d
< 4.59, false, "#2");
1191 Assert (d
< b2
, false, "#2a");
1193 d
= new MyType (30);
1194 MyType v3
= new MyType (30);
1195 Assert (d
< v3
, false, "#3");
1196 dynamic d3
= new MyType (-7);
1197 Assert (d3
< new MyType (6), true, "#3a");
1199 d3
= new MyTypeImplicitOnly (-7);
1200 Assert (d3
< 11, true, "#3b");
1204 Assert (d
< v4
, true, "#4");
1205 Assert (d
< 2m
, false, "#4a");
1208 void LessThanNullableTest ()
1213 Assert (d
< v2
, false, "#1");
1214 Assert (d
< null, false, "#1a");
1215 Assert (null < d
, false, "#1b");
1218 Assert (d
< v2
, false, "#2");
1219 dynamic d2
= (int?) -2;
1220 Assert (d2
< 1, true, "#2a");
1222 Assert (d2
< 44, false, "#2b");
1224 d
= new MyType (30);
1225 MyType
? v3
= new MyType (30);
1226 Assert (d
< v3
, false, "#3");
1227 dynamic d3
= new MyType
? (new MyType (-7));
1228 Assert (d3
< new MyType (6), true, "#3a");
1230 d3
= new MyTypeImplicitOnly (-7);
1231 Assert (d3
< null, false, "#3b");
1235 Assert (d
< v4
, false, "#4");
1237 Assert (d
< v4
, false, "#4a");
1240 void LessThanEnumTest ()
1242 dynamic d
= MyEnum
.Value_1
;
1244 Assert (d
< null, false, "#1");
1246 Assert (d
< MyEnum
.Value_1
, false, "#2");
1247 Assert (d
< 0, false, "#2a");
1249 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_2
;
1250 Assert (d2
< MyEnumUlong
.Value_2
, false, "#3");
1251 Assert (d2
< null, false, "#3a");
1254 void LessThanOrEqualTest ()
1259 Assert (d
<= v
, false, "#1");
1261 Assert (d
<= v2
, true, "#1a");
1264 Assert (d
<= 4.59, false, "#2");
1266 Assert (d
<= b2
, true, "#2a");
1268 d
= new MyType (30);
1269 MyType v3
= new MyType (30);
1270 Assert (d
<= v3
, true, "#3");
1271 dynamic d3
= new MyType (-7);
1272 Assert (d3
<= new MyType (6), true, "#3a");
1274 d3
= new MyTypeImplicitOnly (-7);
1275 Assert (d3
<= 11, true, "#3b");
1279 Assert (d
<= v4
, true, "#4");
1280 Assert (d
<= 2m
, true, "#4a");
1283 void LessThanOrEqualNullableTest ()
1288 Assert (d
<= v2
, false, "#1");
1289 Assert (d
<= null, false, "#1a");
1290 Assert (null <= d
, false, "#1b");
1293 Assert (d
<= v2
, false, "#2");
1294 dynamic d2
= (int?) -2;
1295 Assert (d2
<= 1, true, "#2a");
1297 Assert (d2
<= 44, true, "#2b");
1299 d
= new MyType (30);
1300 MyType
? v3
= new MyType (30);
1301 Assert (d
<= v3
, true, "#3");
1302 dynamic d3
= new MyType
? (new MyType (-7));
1303 Assert (d3
<= new MyType (6), true, "#3a");
1304 Assert (d3
<= null, false, "#3b");
1308 Assert (d
<= v4
, false, "#4");
1310 Assert (d
<= v4
, false, "#4a");
1313 void LessThanOrEqualEnumTest ()
1315 dynamic d
= MyEnum
.Value_1
;
1317 Assert (d
<= null, false, "#1");
1319 Assert (d
<= MyEnum
.Value_1
, true, "#2");
1320 Assert (d
<= 0, false, "#2a");
1322 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_2
;
1323 Assert (d2
<= MyEnumUlong
.Value_2
, true, "#3");
1324 Assert (d2
<= null, false, "#3a");
1332 Assert (d
% v
, 1, "#1");
1335 MyType v3
= new MyType (30);
1336 Assert (d
% v3
, new MyType (5), "#3");
1337 dynamic d3
= new MyType (-7);
1338 Assert
<MyType
> (d3
% new MyType (6), new MyType (-1), "#3a");
1340 d
= new MyTypeImplicitOnly (5);
1342 Assert (d
% v4
, 1m
, "#4");
1345 void ModuloNullableTest ()
1350 Assert
<double?> (d
% v2
, null, "#1");
1351 Assert
<double?> (d
% null, null, "#1a");
1352 Assert
<double?> (null % d
, null, "#1b");
1355 Assert (d
% v2
, 1, "#2");
1356 dynamic d2
= (int?) -2;
1357 Assert (d2
% 1, 0, "#2a");
1359 d
= new MyType (-2);
1360 MyType
? v3
= new MyType (30);
1361 Assert (d
% v3
, new MyType (-2), "#3");
1362 dynamic d3
= new MyType
? (new MyType (-7));
1363 Assert (d3
% new MyType (6), new MyType (-1), "#3a");
1364 Assert
<MyType
?> (d3
+ null, null, "#3b");
1366 d
= new MyTypeImplicitOnly (5);
1368 Assert (d
% v4
, 1m
, "#4");
1370 Assert
<decimal?> (d
% v4
, null, "#4a");
1373 void ModuloAssignTest ()
1379 Assert (d
, 1, "#1");
1384 Assert (d
, 0, "#1a");
1386 Assert (d
, 0, "#1b");
1388 dynamic d3
= new MyType (-7);
1389 d3
%= new MyType (6);
1390 Assert
<MyType
> (d3
, new MyType (-1), "#3");
1395 Assert (d
, 1m
, "#4");
1398 void MultiplyTest ()
1403 Assert (d
* v
, 10, "#1");
1405 Assert (d
* v2
, 2.5, "#1a");
1408 MyType v3
= new MyType (30);
1409 Assert (d
* v3
, new MyType (150), "#3");
1410 dynamic d3
= new MyType (-7);
1411 Assert
<MyType
> (d3
* new MyType (6), new MyType (-42), "#3a");
1415 Assert (d
* v4
, 31.6m
, "#4");
1418 void MultiplyNullableTest ()
1423 Assert
<int?> (d
* v2
, null, "#1");
1424 Assert
<int?> (d
* null, null, "#1a");
1425 Assert
<int?> (null * d
, null, "#1b");
1428 Assert (d
* v2
, -10, "#2");
1429 dynamic d2
= (int?) -2;
1430 Assert (d2
* 1, -2, "#2a");
1433 MyType
? v3
= new MyType (30);
1434 Assert (d
* v3
, new MyType (150), "#3");
1435 dynamic d3
= new MyType
? (new MyType (-7));
1436 Assert (d3
* new MyType (6), new MyType (-42), "#3a");
1437 Assert
<MyType
?> (d3
* null, null, "#3b");
1439 d
= new MyTypeImplicitOnly (5);
1441 Assert (d
* v4
, 20m
, "#4");
1443 Assert
<decimal?> (d
* v4
, null, "#4a");
1446 void MultiplyCheckedTest ()
1451 int v
= int.MaxValue
;
1452 AssertChecked (() => d
* v
, 7, "#1");
1455 AssertChecked (() => d
* v2
, null, "#2");
1458 MyType v3
= new MyType (int.MaxValue
);
1459 Assert (d
* v3
, new MyType (-4), "#3");
1463 void MultiplyAssignTest ()
1469 Assert (d
, 10, "#1");
1474 Assert (d
, 2.5, "#1a");
1476 Assert (d
, 5, "#1b");
1478 dynamic d3
= new MyType (-7);
1479 d3
*= new MyType (6);
1480 Assert
<MyType
> (d3
, new MyType (-42), "#3");
1485 Assert (d
, 20m
, "#4");
1490 Assert (i
, 15, "#5");
1493 void MultiplyAssignCheckedTest ()
1498 int v
= int.MaxValue
;
1499 AssertChecked (() => { d *= v; Assert (d, 0, "#1-"); }
, "#1");
1501 d
= new MyType (44);
1502 MyType v3
= new MyType (int.MaxValue
);
1504 Assert (d
, new MyType (-44), "#3-");
1511 Assert (8, -d
, "#1");
1512 Assert (-8, -(-d
), "#1a");
1514 d
= new MyType (-14);
1515 Assert (new MyType (14), -d
, "#2");
1517 d
= new MyTypeImplicitOnly (4);
1518 Assert (-4, -d
, "#3");
1521 Assert (-7, -d
, "#4");
1523 d
= double.NegativeInfinity
;
1524 Assert (double.PositiveInfinity
, -d
, "#5");
1527 void NegateNullable ()
1529 dynamic d
= (int?) -8;
1530 Assert (8, -d
, "#1");
1531 Assert (-8, -(-d
), "#1a");
1533 MyType
? n1
= new MyType (4);
1535 Assert (new MyType (-4), -d
, "#2");
1537 MyTypeImplicitOnly
? n2
= new MyTypeImplicitOnly (4);
1539 Assert (-4, -d
, "#3");
1542 Assert (-7, -d
, "#4");
1545 void NegateChecked ()
1548 dynamic d
= int.MinValue
;
1549 AssertChecked (() => -d
, 0, "#1");
1556 Assert (false, !d
, "#1");
1558 var de
= new MyType (-1);
1559 Assert (false, !d
, "#2");
1562 void NotEqualTest ()
1567 Assert (d
!= v
, true, "#1");
1569 Assert (d
!= v2
, false, "#1a");
1572 Assert (d
!= false, true, "#2");
1574 Assert (d
!= b2
, false, "#2a");
1576 d
= new MyType (30);
1577 MyType v3
= new MyType (30);
1578 Assert (d
!= v3
, false, "#3");
1579 dynamic d3
= new MyType (-7);
1580 Assert (d3
!= new MyType (6), true, "#3a");
1584 Assert (d
!= v4
, true, "#4");
1585 Assert (d
!= 2m
, false, "#4a");
1588 Assert (d
!= null, false, "#5");
1591 void NotEqualNullableTest ()
1596 Assert (d
!= v2
, true, "#1");
1597 Assert (d
!= null, true, "#1a");
1598 Assert (null != d
, true, "#1b");
1601 Assert (d
!= v2
, true, "#2");
1602 dynamic d2
= (int?) -2;
1603 Assert (d2
!= 1, true, "#2a");
1605 Assert (d2
!= 44, false, "#2b");
1607 d
= new MyType (30);
1608 MyType
? v3
= new MyType (30);
1609 Assert (d
!= v3
, false, "#3");
1610 dynamic d3
= new MyType
? (new MyType (-7));
1611 Assert (d3
!= new MyType (6), true, "#3a");
1612 Assert (d3
!= null, true, "#3b");
1616 Assert (d
!= v4
, true, "#4");
1618 Assert (d
!= v4
, true, "#4a");
1621 Assert (d
!= true, false, "#5");
1622 Assert (d
!= null, true, "#5a");
1623 Assert (d
!= false, true, "#5b");
1627 Assert (d
!= l
, false, "#6a");
1628 Assert (l
!= d
, false, "#6b");
1631 void NotEqualEnumTest ()
1633 dynamic d
= MyEnum
.Value_1
;
1635 Assert (d
!= null, true, "#1");
1637 Assert (d
!= MyEnum
.Value_1
, false, "#2");
1638 Assert (d
!= 0, true, "#2a");
1640 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_2
;
1641 Assert (d2
!= MyEnumUlong
.Value_2
, false, "#3");
1642 Assert (d2
!= null, true, "#3a");
1645 void NotEqualStringTest ()
1649 Assert (d
!= "te", true, "#1");
1650 Assert (d
!= "text", false, "#1a");
1651 Assert (d
!= null, true, "#1b");
1654 void OnesComplement ()
1657 Assert (-8, ~d
, "#1");
1659 d
= new MyType (-1);
1660 Assert (0, ~d
, "#2");
1663 Assert (18446744073709551608, ~d
, "#3");
1666 Assert ((MyEnum
) 254, ~d
, "#4");
1669 void OnesComplementNullable ()
1671 dynamic d
= (int?) 7;
1672 Assert (-8, ~d
, "#1");
1674 d
= (MyEnum
?) MyEnum
.Value_1
;
1675 Assert ((MyEnum
) 254, ~d
, "#4");
1683 Assert (d
| v
, true, "#1");
1684 Assert (d
| false, true, "#1a");
1688 Assert (d
| v2
, 62, "#2");
1689 Assert (d
| 0, 42, "#2a");
1691 d
= new MyType (42);
1692 MyType v3
= new MyType (30);
1693 Assert (d
| v3
, new MyType (62), "#3");
1694 dynamic d3
= new MyType (-7);
1695 Assert
<MyType
> (d3
| new MyType (6), new MyType (-1), "#3a");
1697 d3
= new MyTypeImplicitOnly (-7);
1698 Assert (d3
| 11, -5, "#3b");
1703 dynamic d
= MyEnum
.Value_1
;
1705 Assert
<MyEnum
?> (d
| null, null, "#1");
1707 Assert (d
| d
, MyEnum
.Value_1
, "#2");
1709 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_1
;
1710 Assert
<MyEnumUlong
> (d2
| MyEnumUlong
.Value_2
, (MyEnumUlong
) 3, "#3");
1713 void OrTestNullable ()
1718 Assert
<int?> (d
| v2
, null, "#1");
1719 Assert
<int?> (d
| null, null, "#1a");
1720 Assert
<int?> (null | d
, null, "#1b");
1723 Assert (d
| v2
, -1, "#2");
1724 dynamic d2
= (int?) -2;
1725 Assert (d2
| 1, -1, "#2a");
1727 d
= new MyType (-2);
1728 MyType
? v3
= new MyType (30);
1729 Assert (d
| v3
, new MyType (-2), "#3");
1730 dynamic d3
= new MyType
? (new MyType (-7));
1731 Assert (d3
| new MyType (6), new MyType (-1), "#3a");
1734 void OrAssignedTest ()
1740 Assert (d
, true, "#1");
1743 Assert (d
, true, "#1a");
1748 Assert (d
, 62, "#2");
1750 MyType v3
= new MyType (30);
1751 dynamic d3
= new MyType (-7);
1752 d3
|= new MyType (6);
1753 Assert
<MyType
> (d3
, new MyType (-1), "#3");
1756 void OrAssignedTestEnum ()
1758 dynamic d
= MyEnum
.Value_1
;
1759 d
|= MyEnum
.Value_2
;
1760 Assert
<MyEnum
> (d
, (MyEnum
) 3, "#1");
1764 Assert (d
, MyEnum
.Value_2
, "#2");
1766 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_1
;
1767 Assert
<MyEnumUlong
> (d2
| MyEnumUlong
.Value_2
, (MyEnumUlong
)3, "#3");
1775 Assert
<bool> (d
|| v
, true, "#1");
1777 Assert (d
|| true, true, "#1a");
1780 Assert (d
|| d
, true, "#2");
1782 dynamic d3
= new MyType (-7);
1783 Assert
<MyType
> (d3
|| new MyType (6), new MyType (-7), "#3");
1786 void RightShiftTest ()
1788 dynamic d
= (ulong) 0x7F000;
1791 Assert
<ulong> (d
>> v
, 0x1FC00, "#1");
1792 Assert
<ulong> (d
>> 1, 0x3F800, "#1a");
1794 Assert
<ulong> (d
>> s
, 0x1FC00, "#1b");
1797 MyTypeImplicitOnly v3
= new MyTypeImplicitOnly (3);
1798 Assert (d
>> v3
, 0xFE00, "#3");
1799 dynamic d3
= new MyType (-7);
1800 Assert (d3
>> new MyTypeImplicitOnly (11), -1, "#3a");
1803 void RightShiftNullableTest ()
1808 Assert
<int?> (d
>> v2
, null, "#1");
1810 Assert
<int?> (d
>> null, null, "#1a");
1812 Assert
<int?> (null >> d
, null, "#1b");
1815 Assert (d
>> v2
, 0, "#2");
1816 dynamic d2
= (int?) -200;
1817 Assert (d2
>> 1, -100, "#2a");
1819 dynamic d3
= (int?) null;
1820 Assert (d3
>> (null >> null), (int?) null, "#3");
1823 void RightShiftAssignTest ()
1825 dynamic d
= 0x7F000;
1829 Assert (d
, 0x1FC00, "#1");
1831 Assert (d
, 0xFE00, "#1a");
1834 Assert (d
, 0x3F80, "#1b");
1837 void RightShiftAssignNullableTest ()
1843 Assert (d
, 0, "#2");
1844 dynamic d2
= (int?) -2;
1846 Assert (d2
, -1, "#2a");
1849 void SubtractTest ()
1854 Assert (d
- v
, 3, "#1");
1856 Assert (d
- v2
, 4.5, "#1a");
1859 MyType v3
= new MyType (30);
1860 Assert (d
- v3
, new MyType (-25), "#3");
1861 dynamic d3
= new MyType (-7);
1862 Assert (d3
- new MyType (6), new MyType (-13), "#3a");
1864 d
= new MyTypeImplicitOnly (5);
1866 Assert (d
- v4
, 1m
, "#4");
1869 void SubtractNullableTest ()
1874 Assert
<int?> (d
- v2
, null, "#1");
1875 Assert
<int?> (d
- null, null, "#1a");
1876 Assert
<int?> (null - d
, null, "#1b");
1879 Assert (d
- v2
, 7, "#2");
1880 dynamic d2
= (int?) -2;
1881 Assert (d2
- 1, -3, "#2a");
1884 MyType
? v3
= new MyType (30);
1885 Assert (d
- v3
, new MyType (-25), "#3");
1886 dynamic d3
= new MyType
? (new MyType (-7));
1887 Assert (d3
- new MyType (6), new MyType (-13), "#3a");
1888 Assert
<MyType
?> (d3
- null, null, "#3b");
1890 d
= new MyTypeImplicitOnly (5);
1892 Assert (d
- v4
, 1m
, "#4");
1894 Assert
<decimal?> (d
- v4
, null, "#4a");
1897 void SubtractEnumTest ()
1899 dynamic d
= MyEnum
.Value_1
;
1901 Assert
<MyEnum
> (d
- 1, 0, "#1");
1903 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_2
;
1904 Assert (d2
- (byte) 1, MyEnumUlong
.Value_1
, "#2");
1905 Assert
<MyEnumUlong
?> (d2
- null, null, "#2a");
1907 // CSC: Invalid System.InvalidOperationException
1908 Assert
<MyEnum
?> (d
- null, null, "#3");
1911 void SubtractCheckedTest ()
1916 int v
= int.MinValue
;
1917 AssertChecked (() => d
- v
, 7, "#1");
1920 AssertChecked (() => d
- v2
, null, "#2");
1923 MyType v3
= new MyType (int.MinValue
);
1924 Assert (d
- v3
, new MyType (-2147483643), "#3");
1928 void SubtractAssignTest ()
1934 Assert (d
, 3, "#1");
1939 Assert (d
, 4.5, "#1a");
1941 Assert (d
, 2.5, "#1b");
1943 dynamic d3
= new MyType (-7);
1944 d3
-= new MyType (6);
1945 Assert
<MyType
> (d3
, new MyType (-13), "#3");
1950 Assert (d
, 1m
, "#4");
1953 void SubtractAssignEnumTest ()
1955 dynamic d
= MyEnum
.Value_1
;
1958 Assert
<MyEnum
> (d
, 0, "#2");
1960 dynamic d2
= (MyEnumUlong
?) MyEnumUlong
.Value_2
;
1962 Assert (d2
, MyEnumUlong
.Value_1
, "#3");
1965 void SubtractAssignCheckedTest ()
1970 int v
= int.MinValue
;
1971 AssertChecked (() => { d -= v; Assert (d, 0, "#1a"); }
, "#1");
1974 MyType v3
= new MyType (int.MinValue
);
1976 Assert (d
, new MyType (-2147483643), "#3a");
1980 void SubtractAssignEvent ()
1982 Action print
= () => { Console.WriteLine ("foo"); }
;
1985 // FIXME: Will have to special case events
1990 void UnaryDecrement ()
1993 Assert (3, d
--, "#1");
1994 Assert (2, d
, "#1a");
1997 Assert (2, --d
, "#2");
1998 Assert (2, d
, "#2a");
2000 d
= new MyType (-3);
2001 Assert (new MyType (-3), d
--, "#3");
2002 Assert (new MyType (-1), d
, "#3a");
2005 void UnaryDecrementCheckedTest ()
2008 dynamic d
= int.MinValue
;
2010 AssertChecked (() => { d--; Assert (d, -1073741824, "#1a"); }
, "#1");
2012 d
= new MyType (int.MinValue
);
2014 Assert (d
, new MyType (-1073741824), "#2");
2018 void UnaryIncrement ()
2021 Assert (3, d
++, "#1");
2022 Assert (4, d
, "#1a");
2025 Assert (4, ++d
, "#2");
2026 Assert (4, d
, "#2a");
2028 d
= new MyType (-3);
2029 Assert (new MyType (-3), d
++, "#3");
2030 Assert (new MyType (-6), d
, "#3a");
2033 void UnaryIncrementCheckedTest ()
2036 dynamic d
= int.MaxValue
;
2038 AssertChecked (() => { d++; Assert (d, 0, "#1a"); }
, "#1");
2040 d
= new MyType (int.MaxValue
);
2042 Assert (d
, new MyType (-2), "#2");
2046 //void UnaryIsFalse ()
2048 // dynamic d = this;
2049 // object r = d == null;
2050 // Assert (false, (bool) r, "#1");
2051 // Assert<object> (true, d != null, "#1a");
2057 Assert (3, d
? 3 : 5, "#1");
2060 Assert (false, d
< 1, "#2");
2062 d
= new InverseLogicalOperator (true);
2063 Assert (1, d
? 1 : -1, "#3");
2069 Assert (-8, +d
, "#1");
2070 Assert (-8, +(+d
), "#1a");
2072 d
= new MyType (14);
2073 Assert (new MyType (334455), +d
, "#2");
2075 d
= new MyTypeImplicitOnly (4);
2076 Assert (4, +d
, "#3");
2079 Assert
<uint> (7, +d
, "#4");
2082 void UnaryPlusNullable ()
2084 dynamic d
= (int?) -8;
2085 Assert (-8, +d
, "#1");
2086 Assert (-8, +(+d
), "#1a");
2088 MyType
? n1
= new MyType (4);
2090 Assert (new MyType (334455), +d
, "#2");
2092 MyTypeImplicitOnly
? n2
= new MyTypeImplicitOnly (4);
2094 Assert (4, +d
, "#3");
2097 Assert (7, +d
, "#4");
2100 #pragma warning restore 169
2102 static bool RunTest (MethodInfo test
)
2104 Console
.Write ("Running test {0, -25}", test
.Name
);
2106 test
.Invoke (new Tester (), null);
2107 Console
.WriteLine ("OK");
2109 } catch (Exception e
) {
2110 Console
.WriteLine ("FAILED");
2111 Console
.WriteLine (e
.ToString ());
2116 public static int Main ()
2118 var tests
= from test
in typeof (Tester
).GetMethods (BindingFlags
.Instance
| BindingFlags
.NonPublic
| BindingFlags
.DeclaredOnly
)
2119 where test
.GetParameters ().Length
== 0
2121 select RunTest (test
);
2123 int failures
= tests
.Count (a
=> !a
);
2124 Console
.WriteLine (failures
+ " tests failed");