1 | package de.uka.ipd.sdq.pcmsolver.tests; |
2 | |
3 | |
4 | public class BranchActionHandlerTest { |
5 | |
6 | // private BranchActionHandler branchActionHandler = null; |
7 | // private BranchAction branchAction = null; |
8 | // |
9 | // @Before |
10 | // public void setUp(){ |
11 | // Context context = new Context(); |
12 | // |
13 | // UsageFactory uf = UsageFactory.eINSTANCE; |
14 | // context.setUsageContext(uf.createUsageContext()); |
15 | // context.setCurrentEvaluatedBranchConditions(new ArrayList()); |
16 | // |
17 | // SeffVisitor visitor = new SeffVisitor(null, context); |
18 | // |
19 | // branchActionHandler = new BranchActionHandler(context, visitor, null); |
20 | // |
21 | // |
22 | // SeffFactory sf = SeffFactory.eINSTANCE; |
23 | // branchAction = sf.createBranchAction(); |
24 | // |
25 | // BranchTransition bt1 = sf.createBranchTransition(); |
26 | // bt1.setBranchProbability(0.3); |
27 | // branchAction.getBranches_Branch().add(bt1); |
28 | // |
29 | // BranchTransition bt2 = sf.createBranchTransition(); |
30 | // BranchCondition branchCondition2 = sf.createBranchCondition(); |
31 | // branchCondition2.setSpecification("3<4"); |
32 | // bt2.setBranchCondition_BranchTransition(branchCondition2); |
33 | // branchAction.getBranches_Branch().add(bt2); |
34 | // |
35 | // BranchTransition bt3 = sf.createBranchTransition(); |
36 | // BranchCondition branchCondition3 = sf.createBranchCondition(); |
37 | // branchCondition3.setSpecification("IntPMF(unit=\"unit\")[ (0.1; 1) (0.2; 2) (0.7; 3) ] > 1"); |
38 | // bt3.setBranchCondition_BranchTransition(branchCondition3); |
39 | // branchAction.getBranches_Branch().add(bt3); |
40 | // } |
41 | // |
42 | // /** |
43 | // * Tests, whether branch probabilities are correctly stored |
44 | // * into the usage context. |
45 | // */ |
46 | // @Test |
47 | // public void handle(){ |
48 | // branchActionHandler.handle(branchAction); |
49 | // |
50 | // EList branchProbs = branchActionHandler.getMyContext() |
51 | // .getUsageContext().getBranchprobabilities_UsageContext(); |
52 | // assertFalse(branchProbs.isEmpty()); |
53 | // |
54 | // BranchProbability bp1 = (BranchProbability)branchProbs.get(0); |
55 | // assertTrue(bp1.getProbability() == 0.3); |
56 | // |
57 | // BranchProbability bp2 = (BranchProbability)branchProbs.get(1); |
58 | // assertTrue(bp2.getProbability() == 1.0); |
59 | // |
60 | // BranchProbability bp3 = (BranchProbability)branchProbs.get(2); |
61 | // assertTrue(bp3.getProbability() == 0.9); |
62 | // |
63 | // } |
64 | // |
65 | // |
66 | // public static junit.framework.Test suite() { |
67 | // return new JUnit4TestAdapter(LoopActionHandlerTest.class); |
68 | // } |
69 | } |