From 497b0cb09a750fe05cf6c7c1cae2e3b960772ec4 Mon Sep 17 00:00:00 2001 From: Simon Ochsenreither Date: Thu, 4 Apr 2013 17:13:04 +0200 Subject: Add float version of the double NaN tests The double version uncovered a bug in Avian already, so let's be safe and cover all the NaNs we have. --- test/files/run/blame_eye_triple_eee-double.check | 9 ++++ test/files/run/blame_eye_triple_eee-double.flags | 1 + test/files/run/blame_eye_triple_eee-double.scala | 61 ++++++++++++++++++++++++ test/files/run/blame_eye_triple_eee-float.check | 9 ++++ test/files/run/blame_eye_triple_eee-float.flags | 1 + test/files/run/blame_eye_triple_eee-float.scala | 61 ++++++++++++++++++++++++ test/files/run/blame_eye_triple_eee.check | 9 ---- test/files/run/blame_eye_triple_eee.flags | 1 - test/files/run/blame_eye_triple_eee.scala | 61 ------------------------ 9 files changed, 142 insertions(+), 71 deletions(-) create mode 100644 test/files/run/blame_eye_triple_eee-double.check create mode 100644 test/files/run/blame_eye_triple_eee-double.flags create mode 100644 test/files/run/blame_eye_triple_eee-double.scala create mode 100644 test/files/run/blame_eye_triple_eee-float.check create mode 100644 test/files/run/blame_eye_triple_eee-float.flags create mode 100644 test/files/run/blame_eye_triple_eee-float.scala delete mode 100644 test/files/run/blame_eye_triple_eee.check delete mode 100644 test/files/run/blame_eye_triple_eee.flags delete mode 100644 test/files/run/blame_eye_triple_eee.scala diff --git a/test/files/run/blame_eye_triple_eee-double.check b/test/files/run/blame_eye_triple_eee-double.check new file mode 100644 index 0000000000..5e46d91a8f --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-double.check @@ -0,0 +1,9 @@ +if (NaN == NaN) is good +if (x == x) is good +if (x == NaN) is good +if (NaN != NaN) is good +if (x != x) is good +if (NaN != x) is good +x matching was good +NaN matching was good +loop with NaN was goood diff --git a/test/files/run/blame_eye_triple_eee-double.flags b/test/files/run/blame_eye_triple_eee-double.flags new file mode 100644 index 0000000000..c9b68d70dc --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-double.flags @@ -0,0 +1 @@ +-optimise diff --git a/test/files/run/blame_eye_triple_eee-double.scala b/test/files/run/blame_eye_triple_eee-double.scala new file mode 100644 index 0000000000..1640aead40 --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-double.scala @@ -0,0 +1,61 @@ +object Test extends App { + import Double.NaN + + // NaN must not equal NaN no matter what optimizations are applied + // All the following will seem redundant, but to an optimizer + // they can appear different + + val x = NaN + + if (NaN == NaN) + println("if (NaN == NaN) is broken") + else + println("if (NaN == NaN) is good") + + if (x == x) + println("if (x == x) is broken") + else + println("if (x == x) is good") + + if (x == NaN) + println("if (x == NaN) is broken") + else + println("if (x == NaN) is good") + + if (NaN != NaN) + println("if (NaN != NaN) is good") + else + println("if (NaN != NaN) broken") + + if (x != x) + println("if (x != x) is good") + else + println("if (x != x) broken") + + if (NaN != x) + println("if (NaN != x) is good") + else + println("if (NaN != x) is broken") + + x match { + case 0.0d => println("x matched 0!") + case NaN => println("x matched NaN!") + case _ => println("x matching was good") + } + + NaN match { + case 0.0d => println("NaN matched 0!") + case NaN => println("NaN matched NaN!") + case _ => println("NaN matching was good") + } + + var z = 0.0d + var i = 0 + while (i < 10) { + if (i % 2 == 0) z = NaN + else z = NaN + i += 1 + } + if (z.isNaN && i == 10) println("loop with NaN was goood") + else println("loop with NaN was broken") +} diff --git a/test/files/run/blame_eye_triple_eee-float.check b/test/files/run/blame_eye_triple_eee-float.check new file mode 100644 index 0000000000..5e46d91a8f --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-float.check @@ -0,0 +1,9 @@ +if (NaN == NaN) is good +if (x == x) is good +if (x == NaN) is good +if (NaN != NaN) is good +if (x != x) is good +if (NaN != x) is good +x matching was good +NaN matching was good +loop with NaN was goood diff --git a/test/files/run/blame_eye_triple_eee-float.flags b/test/files/run/blame_eye_triple_eee-float.flags new file mode 100644 index 0000000000..c9b68d70dc --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-float.flags @@ -0,0 +1 @@ +-optimise diff --git a/test/files/run/blame_eye_triple_eee-float.scala b/test/files/run/blame_eye_triple_eee-float.scala new file mode 100644 index 0000000000..4deb9f3d60 --- /dev/null +++ b/test/files/run/blame_eye_triple_eee-float.scala @@ -0,0 +1,61 @@ +object Test extends App { + import Float.NaN + + // NaN must not equal NaN no matter what optimizations are applied + // All the following will seem redundant, but to an optimizer + // they can appear different + + val x = NaN + + if (NaN == NaN) + println("if (NaN == NaN) is broken") + else + println("if (NaN == NaN) is good") + + if (x == x) + println("if (x == x) is broken") + else + println("if (x == x) is good") + + if (x == NaN) + println("if (x == NaN) is broken") + else + println("if (x == NaN) is good") + + if (NaN != NaN) + println("if (NaN != NaN) is good") + else + println("if (NaN != NaN) broken") + + if (x != x) + println("if (x != x) is good") + else + println("if (x != x) broken") + + if (NaN != x) + println("if (NaN != x) is good") + else + println("if (NaN != x) is broken") + + x match { + case 0.0f => println("x matched 0!") + case NaN => println("x matched NaN!") + case _ => println("x matching was good") + } + + NaN match { + case 0.0f => println("NaN matched 0!") + case NaN => println("NaN matched NaN!") + case _ => println("NaN matching was good") + } + + var z = 0.0f + var i = 0 + while (i < 10) { + if (i % 2 == 0) z = NaN + else z = NaN + i += 1 + } + if (z.isNaN && i == 10) println("loop with NaN was goood") + else println("loop with NaN was broken") +} diff --git a/test/files/run/blame_eye_triple_eee.check b/test/files/run/blame_eye_triple_eee.check deleted file mode 100644 index 5e46d91a8f..0000000000 --- a/test/files/run/blame_eye_triple_eee.check +++ /dev/null @@ -1,9 +0,0 @@ -if (NaN == NaN) is good -if (x == x) is good -if (x == NaN) is good -if (NaN != NaN) is good -if (x != x) is good -if (NaN != x) is good -x matching was good -NaN matching was good -loop with NaN was goood diff --git a/test/files/run/blame_eye_triple_eee.flags b/test/files/run/blame_eye_triple_eee.flags deleted file mode 100644 index c9b68d70dc..0000000000 --- a/test/files/run/blame_eye_triple_eee.flags +++ /dev/null @@ -1 +0,0 @@ --optimise diff --git a/test/files/run/blame_eye_triple_eee.scala b/test/files/run/blame_eye_triple_eee.scala deleted file mode 100644 index 1640aead40..0000000000 --- a/test/files/run/blame_eye_triple_eee.scala +++ /dev/null @@ -1,61 +0,0 @@ -object Test extends App { - import Double.NaN - - // NaN must not equal NaN no matter what optimizations are applied - // All the following will seem redundant, but to an optimizer - // they can appear different - - val x = NaN - - if (NaN == NaN) - println("if (NaN == NaN) is broken") - else - println("if (NaN == NaN) is good") - - if (x == x) - println("if (x == x) is broken") - else - println("if (x == x) is good") - - if (x == NaN) - println("if (x == NaN) is broken") - else - println("if (x == NaN) is good") - - if (NaN != NaN) - println("if (NaN != NaN) is good") - else - println("if (NaN != NaN) broken") - - if (x != x) - println("if (x != x) is good") - else - println("if (x != x) broken") - - if (NaN != x) - println("if (NaN != x) is good") - else - println("if (NaN != x) is broken") - - x match { - case 0.0d => println("x matched 0!") - case NaN => println("x matched NaN!") - case _ => println("x matching was good") - } - - NaN match { - case 0.0d => println("NaN matched 0!") - case NaN => println("NaN matched NaN!") - case _ => println("NaN matching was good") - } - - var z = 0.0d - var i = 0 - while (i < 10) { - if (i % 2 == 0) z = NaN - else z = NaN - i += 1 - } - if (z.isNaN && i == 10) println("loop with NaN was goood") - else println("loop with NaN was broken") -} -- cgit v1.2.3