summaryrefslogtreecommitdiffstats
path: root/tests/bugs152/pr148007/purejava/test/BooleanUnitTest.java
blob: 0d4ee3e451aded6c0edd427df411256e732025ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package test;

/**
 * Understands . . .
 *
 * @author Randy Stearns
 */
public class BooleanUnitTest  {

	public static void main(String[] args) {
		new BooleanUnitTest().test1();
	}
	
    public void test1() {
        assertEquals("1a WRONG!", false, invert1a());
        assertEquals("1b WRONG!", true, invert1b());
        assertEquals("2 WRONG!", false, invert2());
        assertEquals("3 WRONG!", true, invert3());
        assertEquals("4 WRONG!", true, invert4());
        assertEquals("5 WRONG!", false, invert5());
    }
    
    private void assertEquals(String msg, boolean a, boolean b) {
    	if (a != b) {
    		throw new RuntimeException(msg);
    	}
    }

    private boolean invert1a() {
        return ! true;
    }

    private boolean invert1b() {
        return ! false;
    }

    private boolean invert2() {
    	boolean ret = false;
    	try {
	        ret = ! isTrue();
    	}
    	catch (RuntimeException t) {
	   		LoggingAspect.aspectOf().ajc$afterReturning$test_LoggingAspect$1$188fbb36();
	   		throw t;
    	}
   		LoggingAspect.aspectOf().ajc$afterReturning$test_LoggingAspect$1$188fbb36();
   		return ret;
    }

    private boolean invert3() {
        return ! isFalse();
    }

    private boolean invert4() {
        boolean temp = isFalse();
        return ! temp;
    }

    private boolean invert5() {
        boolean temp = isTrue();
        return ! temp;
    }

    private boolean isTrue() {
        return true;
    }

    private boolean isFalse() {
        return false;
    }
}