Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/profiles/BranchProfileTest.java @ 22526:a5e58793bbca
BranchProfile Javadoc sample was uncompilable. Fixed with the help of codesnippet tag.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 30 Dec 2015 11:06:33 +0100 |
parents | a63bda98cfdb |
children | 4ba1aa33fda4 |
comparison
equal
deleted
inserted
replaced
22525:89db2519ef18 | 22526:a5e58793bbca |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.truffle.api.profiles; | 23 package com.oracle.truffle.api.profiles; |
24 | 24 |
25 import com.oracle.truffle.api.nodes.Node; | |
25 import static org.junit.Assert.assertTrue; | 26 import static org.junit.Assert.assertTrue; |
26 | 27 |
27 import org.junit.Test; | 28 import org.junit.Test; |
28 | 29 |
29 public class BranchProfileTest { | 30 public class BranchProfileTest { |
45 assertTrue(profile.toString().contains(BranchProfile.class.getSimpleName())); | 46 assertTrue(profile.toString().contains(BranchProfile.class.getSimpleName())); |
46 assertTrue(profile.toString().contains("VISITED")); | 47 assertTrue(profile.toString().contains("VISITED")); |
47 assertTrue(profile.toString().contains(Integer.toHexString(profile.hashCode()))); | 48 assertTrue(profile.toString().contains(Integer.toHexString(profile.hashCode()))); |
48 } | 49 } |
49 | 50 |
51 // BEGIN: BranchProfileSample | |
52 class SampleNode extends Node { | |
53 final BranchProfile errorProfile = BranchProfile.create(); | |
54 | |
55 int execute(int value) { | |
56 if (value == Integer.MAX_VALUE) { | |
57 errorProfile.enter(); | |
58 throw new Error("Invalid input value"); | |
59 } | |
60 return value; | |
61 } | |
62 } | |
63 // END: BranchProfileSample | |
50 } | 64 } |