Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/BooleanConditionProfileTest.java @ 16852:3c114b3e08c3
Truffle: renamed BooleanConditionProfile to BinaryConditionProfile and IntegerConditionProfile to CountingConditionProfile.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 18 Aug 2014 19:00:20 +0200 |
parents | 2834af86f398 |
children | fc6f12ee71e5 |
comparison
equal
deleted
inserted
replaced
16851:2db61eddcb97 | 16852:3c114b3e08c3 |
---|---|
36 | 36 |
37 @DataPoints public static boolean[] data = new boolean[]{true, false}; | 37 @DataPoints public static boolean[] data = new boolean[]{true, false}; |
38 | 38 |
39 @Test | 39 @Test |
40 public void testInitial() { | 40 public void testInitial() { |
41 BooleanConditionProfile profile = new BooleanConditionProfile(); | 41 BinaryConditionProfile profile = new BinaryConditionProfile(); |
42 assertThat(profile.wasTrue(), is(false)); | 42 assertThat(profile.wasTrue(), is(false)); |
43 assertThat(profile.wasFalse(), is(false)); | 43 assertThat(profile.wasFalse(), is(false)); |
44 } | 44 } |
45 | 45 |
46 @Theory | 46 @Theory |
47 public void testProfileOne(boolean value) { | 47 public void testProfileOne(boolean value) { |
48 BooleanConditionProfile profile = new BooleanConditionProfile(); | 48 BinaryConditionProfile profile = new BinaryConditionProfile(); |
49 boolean result = profile.profile(value); | 49 boolean result = profile.profile(value); |
50 | 50 |
51 assertThat(result, is(value)); | 51 assertThat(result, is(value)); |
52 assertThat(profile.wasTrue(), is(value)); | 52 assertThat(profile.wasTrue(), is(value)); |
53 assertThat(profile.wasFalse(), is(!value)); | 53 assertThat(profile.wasFalse(), is(!value)); |
54 } | 54 } |
55 | 55 |
56 @Theory | 56 @Theory |
57 public void testProfileTwo(boolean value0, boolean value1) { | 57 public void testProfileTwo(boolean value0, boolean value1) { |
58 BooleanConditionProfile profile = new BooleanConditionProfile(); | 58 BinaryConditionProfile profile = new BinaryConditionProfile(); |
59 boolean result0 = profile.profile(value0); | 59 boolean result0 = profile.profile(value0); |
60 boolean result1 = profile.profile(value1); | 60 boolean result1 = profile.profile(value1); |
61 | 61 |
62 assertThat(result0, is(value0)); | 62 assertThat(result0, is(value0)); |
63 assertThat(result1, is(value1)); | 63 assertThat(result1, is(value1)); |
65 assertThat(profile.wasFalse(), is(!value0 || !value1)); | 65 assertThat(profile.wasFalse(), is(!value0 || !value1)); |
66 } | 66 } |
67 | 67 |
68 @Theory | 68 @Theory |
69 public void testProfileThree(boolean value0, boolean value1, boolean value2) { | 69 public void testProfileThree(boolean value0, boolean value1, boolean value2) { |
70 BooleanConditionProfile profile = new BooleanConditionProfile(); | 70 BinaryConditionProfile profile = new BinaryConditionProfile(); |
71 boolean result0 = profile.profile(value0); | 71 boolean result0 = profile.profile(value0); |
72 boolean result1 = profile.profile(value1); | 72 boolean result1 = profile.profile(value1); |
73 boolean result2 = profile.profile(value2); | 73 boolean result2 = profile.profile(value2); |
74 | 74 |
75 assertThat(result0, is(value0)); | 75 assertThat(result0, is(value0)); |