PageRenderTime 10ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/test/kilim/test/TestBasicBlock.java

http://github.com/kilim/kilim
Java | 72 lines | 51 code | 16 blank | 5 comment | 4 complexity | 785ee15640808c4826029ace0b33c9f0 MD5 | raw file
 1/* Copyright (c) 2006, Sriram Srinivasan
 2 *
 3 * You may distribute this software under the terms of the license 
 4 * specified in the file "License"
 5 */
 6
 7package kilim.test;
 8
 9import kilim.analysis.MethodFlow;
10
11public class TestBasicBlock extends Base {
12
13    @Override
14    protected void setUp() throws Exception {
15        cache("kilim.test.ex.ExBasicBlock");
16    }
17
18    public void testNumFlows() {
19        assertEquals(getFlows().size(), 8);
20    }
21
22    private void checkSize(String methodName, int expectedSize) {
23        MethodFlow f = getFlow(methodName);
24        if (f == null)
25            return;
26        if (f.getBasicBlocks().size() != expectedSize) {
27            fail("Method " + methodName + ": expected flow size = "
28                    + expectedSize + ", instead got "
29                    + f.getBasicBlocks().size());
30        }
31    }
32
33    public void testNoopSize() {
34        checkSize("noop", 1);
35    }
36
37    public void testLoopSize() {
38        checkSize("loop", 4);
39    }
40
41    public void testExceptionSize() {
42        checkSize("exception", 8);
43    }
44
45    public void testNestedSize() {
46        checkSize("nestedloop", 6);
47    }
48
49    public void testComplexSize() {
50        checkSize("complex", 14);
51    }
52
53    public void testNoopCov() {
54        checkCov("noop");
55    }
56
57    public void testLoopCov() {
58        checkCov("loop");
59    }
60
61    public void testExceptionCov() {
62        checkCov("exception");
63    }
64
65    public void testNestedCov() {
66        checkCov("nestedloop");
67    }
68
69    public void testComplexCov() {
70        checkCov("complex");
71    }
72}