comparison truffle/com.oracle.truffle.tck/src/com/oracle/truffle/tck/TruffleTCK.java @ 22545:17fe5ef92696

More tests with doubles in the TCK to verify IEEE754 compliance
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Thu, 14 Jan 2016 14:09:27 +0100
parents 9aded7e1e122
children e77bcc4e4af6
comparison
equal deleted inserted replaced
22544:9aded7e1e122 22545:17fe5ef92696
579 double b = 1; 579 double b = 1;
580 580
581 doPlusWithDouble(a, b); 581 doPlusWithDouble(a, b);
582 } 582 }
583 583
584 @Test
585 public void testPlusWithDoubleMaxMinInt() throws Exception {
586 double a = Integer.MAX_VALUE;
587 double b = Integer.MIN_VALUE;
588
589 doPlusWithDouble(a, b);
590 }
591
592 @Test
593 public void testPlusWithDoubleMinIntMinusOne() throws Exception {
594 double a = -1;
595 double b = Integer.MIN_VALUE;
596
597 doPlusWithDouble(a, b);
598 }
599
600 @Test
601 public void testPlusWithDoubleMaxIntPlusOne() throws Exception {
602 double a = 1;
603 double b = Integer.MAX_VALUE;
604
605 doPlusWithDouble(a, b);
606 }
607
608 @Test
609 public void testPlusWithDoubleNaNPlusNegInf() throws Exception {
610 double a = Double.NaN;
611 double b = Double.NEGATIVE_INFINITY;
612
613 doPlusWithDouble(a, b);
614 }
615
616 @Test
617 public void testPlusWithDoubleNaNPlusPosInf() throws Exception {
618 double a = Double.NaN;
619 double b = Double.POSITIVE_INFINITY;
620
621 doPlusWithDouble(a, b);
622 }
623
624 @Test
625 public void testPlusWithDoubleMaxIntPlusPosInf() throws Exception {
626 double a = Integer.MAX_VALUE;
627 double b = Double.POSITIVE_INFINITY;
628
629 doPlusWithDouble(a, b);
630 }
631
632 @Test
633 public void testPlusWithDoubleMaxIntPlusNegInf() throws Exception {
634 double a = Integer.MAX_VALUE;
635 double b = Double.NEGATIVE_INFINITY;
636
637 doPlusWithDouble(a, b);
638 }
639
584 private void doPlusWithDouble(double a, double b) throws Exception { 640 private void doPlusWithDouble(double a, double b) throws Exception {
585 PolyglotEngine.Value plus = findGlobalSymbol(plus(double.class, double.class)); 641 PolyglotEngine.Value plus = findGlobalSymbol(plus(double.class, double.class));
586 642
587 Number n = plus.execute(a, b).as(Number.class); 643 Number n = plus.execute(a, b).as(Number.class);
588 assertDouble("Correct value computed: (" + a + " + " + b + ")", a + b, n.doubleValue()); 644 assertDouble("Correct value computed: (" + a + " + " + b + ")", a + b, n.doubleValue());