/* A comparison made to same variable. */
#pragma warning disable 1718
-#if MOBILE
+#if __MOBILE__
class FloatTests
#else
class Tests
#endif
{
-#if !MOBILE
+#if !__MOBILE__
public static int Main (string[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
ui = (uint)d;
if (ui != 0)
return 9;
+ /* FIXME: This fails with llvm and with gcc -O2 on osx/linux */
+ /*
d = Double.MaxValue;
i = (int)d;
if (i != -2147483648)
return 10;
+ */
return 0;
}
return 1;
return 0;
}
+
+ public static int test_5_r4_fadd () {
+ float f1 = 3.0f;
+ float f2 = 2.0f;
+ return (int)(f1 + f2);
+ }
+
+ public static int test_1_r4_fsub () {
+ float f1 = 3.0f;
+ float f2 = 2.0f;
+ return (int)(f1 - f2);
+ }
+
+ public static int test_6_fmul_r4 () {
+ float f1 = 2.0f;
+ float f2 = 3.0f;
+ return (int)(f1 * f2);
+ }
+
+ public static int test_3_fdiv_r4 () {
+ float f1 = 6.0f;
+ float f2 = 2.0f;
+ return (int)(f1 / f2);
+ }
+
+ public static int test_1_frem_r4 () {
+ float f1 = 7.0f;
+ float f2 = 2.0f;
+ return (int)(f1 % f2);
+ }
+
+ public static int test_0_fcmp_eq_r4 () {
+ float f1 = 1.0f;
+ float f2 = 1.0f;
+ return f1 == f2 ? 0 : 1;
+ }
+
+ public static int test_0_fcmp_eq_2_r4 () {
+ float f1 = 1.0f;
+ float f2 = 2.0f;
+ return f1 == f2 ? 1 : 0;
+ }
+
+ public static int test_0_fcmp_eq_r4_mixed () {
+ float f1 = 1.0f;
+ double f2 = 1.0;
+ return f1 == f2 ? 0 : 1;
+ }
+
+ public static int test_3_iconv_to_r4 () {
+ int i = 3;
+ float f = (float)i;
+ return (int)f;
+ }
+
+ public static int test_2_neg_r4 () {
+ float a = -2.0f;
+ return (int)(-a);
+ }
+
+ public static int test_0_fceq_r4 () {
+ float f1 = 1.0f;
+ float f2 = 1.0f;
+ bool res = f1 == f2;
+ return res ? 0 : 1;
+ }
+
+ public static int test_0_fcgt_r4 () {
+ float f1 = 2.0f;
+ float f2 = 1.0f;
+ bool res = f1 > f2;
+ bool res2 = f2 > f1;
+ return res && !res2 ? 0 : 1;
+ }
+
+ public static int test_0_fclt_r4 () {
+ float f1 = 1.0f;
+ float f2 = 2.0f;
+ bool res = f1 < f2;
+ bool res2 = f2 < f1;
+ return res && !res2 ? 0 : 1;
+ }
+
+ public static int test_0_fclt_un_r4 () {
+ float f1 = 2.0f;
+ float f2 = 1.0f;
+ bool res = f1 >= f2;
+ bool res2 = f2 >= f1;
+ return res && !res2 ? 0 : 1;
+ }
+
+ public static int test_0_fcgt_un_r4 () {
+ float f1 = 1.0f;
+ float f2 = 2.0f;
+ bool res = f1 <= f2;
+ bool res2 = f2 <= f1;
+ return res && !res2 ? 0 : 1;
+ }
+
+ public static int test_0_fconv_to_u4_r4 () {
+ float a = 10.0f;
+
+ uint b = (uint)a;
+ return b == 10 ? 0 : 1;
+ }
+
+ public static int test_0_fconv_to_u1_r4 () {
+ float a = 10.0f;
+
+ byte b = (byte)a;
+ return b == 10 ? 0 : 1;
+ }
+
+ public static int test_0_fconv_to_i1_r4 () {
+ float a = 127.0f;
+
+ sbyte b = (sbyte)a;
+ return b == 127 ? 0 : 1;
+ }
+
+ public static int test_0_fconv_to_u2_r4 () {
+ float a = 10.0f;
+
+ ushort b = (ushort)a;
+ return b == 10 ? 0 : 1;
+ }
+
+ public static int test_0_fconv_to_i2_r4 () {
+ float a = 127.0f;
+
+ short b = (short)a;
+ return b == 127 ? 0 : 1;
+ }
+
+ public static int test_10_rconv_to_u8 () {
+ ulong l = 10;
+ float f = (float)l;
+ l = (ulong)f;
+ return (int)l;
+ }
+
}