Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/utilities/IntegerConditionProfileTest.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 IntegerConditionProfile profile = new IntegerConditionProfile(); | 41 CountingConditionProfile profile = new CountingConditionProfile(); |
42 assertThat(profile.getTrueCount(), is(0)); | 42 assertThat(profile.getTrueCount(), is(0)); |
43 assertThat(profile.getFalseCount(), is(0)); | 43 assertThat(profile.getFalseCount(), is(0)); |
44 } | 44 } |
45 | 45 |
46 @Theory | 46 @Theory |
47 public void testProfileOne(boolean value) { | 47 public void testProfileOne(boolean value) { |
48 IntegerConditionProfile profile = new IntegerConditionProfile(); | 48 CountingConditionProfile profile = new CountingConditionProfile(); |
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.getTrueCount(), is(value ? 1 : 0)); | 52 assertThat(profile.getTrueCount(), is(value ? 1 : 0)); |
53 assertThat(profile.getFalseCount(), is(!value ? 1 : 0)); | 53 assertThat(profile.getFalseCount(), is(!value ? 1 : 0)); |
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 IntegerConditionProfile profile = new IntegerConditionProfile(); | 58 CountingConditionProfile profile = new CountingConditionProfile(); |
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.getFalseCount(), is((!value0 ? 1 : 0) + (!value1 ? 1 : 0))); | 65 assertThat(profile.getFalseCount(), is((!value0 ? 1 : 0) + (!value1 ? 1 : 0))); |
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 IntegerConditionProfile profile = new IntegerConditionProfile(); | 70 CountingConditionProfile profile = new CountingConditionProfile(); |
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)); |