(mono_marshal_get_native_wrapper): better string marshaling support.
[mono.git] / mono / tests / ckfiniteTest.il
1 //Tests the ckfinite instruction
2 //First test on an infinite (finite / 0)
3 //Second test on NaN (0 / 0)
4 //Third test sees if value is left on stack if finite
5 //Both print either PASS or FAIL
6 //Assumes div works as per specifications
7
8 .assembly extern mscorlib{}
9 .assembly someTest{}
10 .module someTest
11
12 .class private auto ansi someTest
13        extends [mscorlib]System.Object {
14
15   .method public static void  go() cil managed {
16     .entrypoint
17
18 //TEST 1 - infinite
19
20 .try {
21         ldc.r8 1
22         ldc.r8 0
23         div
24         ckfinite
25         ldstr "FAIL"
26         call void [mscorlib]System.Console::WriteLine(string)
27         leave test2
28 }
29 catch [mscorlib]System.ArithmeticException {
30         pop
31         ldstr "PASS"
32         call void [mscorlib]System.Console::WriteLine(string)
33         leave test2
34 }
35 catch [mscorlib]System.Exception {
36         pop
37         ldstr "EFAIL"
38         call void [mscorlib]System.Console::WriteLine(string)
39         leave test2
40 }
41
42 //TEST 2 - NaN
43 test2: nop
44
45 .try {
46         ldc.r8 0
47         ldc.r8 0
48         div
49         ckfinite
50         ldstr "FAIL"
51         call void [mscorlib]System.Console::WriteLine(string)
52         leave test3
53 }
54 catch [mscorlib]System.ArithmeticException {
55         ldstr "PASS"
56         call void [mscorlib]System.Console::WriteLine(string)
57         leave test3
58 }
59 catch [mscorlib]System.Exception {
60         ldstr "FAIL"
61         call void [mscorlib]System.Console::WriteLine(string)
62         leave test3
63 }
64
65 //TEST 3
66 test3: nop
67
68 .try {
69         ldc.r8 3.777
70         ckfinite
71         ldc.r8 3.777
72         bne.un FAIL
73         ldstr "PASS"
74         call void [mscorlib]System.Console::WriteLine(string)
75         leave end
76                                 
77 FAIL:   ldstr "FAIL"
78         call void [mscorlib]System.Console::WriteLine(string)
79         leave end
80 }
81 catch [mscorlib]System.Exception {
82         ldstr "FAIL"
83         call void [mscorlib]System.Console::WriteLine(string)
84         leave end
85 }
86
87 end:    ret
88   }
89
90
91