Package net.sourceforge.cobertura.coveragedata

Examples of net.sourceforge.cobertura.coveragedata.SwitchData


                        ArrayList<Long> result = new ArrayList<Long>();
                        if (ld.hasBranch()) {
                            for (int i = 0; i < ld.getConditionSize(); i++) {
                                Object xcd = ld.getConditionData(i);
                                if (xcd instanceof SwitchData) {
                                    SwitchData sd = (SwitchData) xcd;
                                    for (int j = 0; j < sd
                                            .getNumberOfValidBranches() - 1; j++) {
                                        result.add(sd.getHits(j));
                                    }
                                    result.add(sd.getDefaultHits());
                                } else {
                                    JumpData jd = (JumpData) xcd;
                                    result.add(jd.getTrueHits());
                                    result.add(jd.getFalseHits());
                                }
View Full Code Here


                                + "true from " + prevTrue + " by "
                                + diffTrueHits + ", false from " + prevFalse
                                + " by " + diffFalseHits);
                    }
                } else if (cd instanceof SwitchData) {
                    SwitchData lsd = (SwitchData) cd;
                    result.addLineSwitch(lld.getLineNumber(), i, 0, 0, lsd.getMaxBranches());
                    long[] prevBranchHits = new long[lsd
                            .getNumberOfValidBranches() - 1];
                    long prevDefaultHits = 0;
                    if (smaller != null) {
                        LineData sld = smaller.getLineCoverage(lld
                                .getLineNumber());
                        if (sld != null) {
                            SwitchData ssd = (SwitchData) sld
                                    .getConditionData(i);
                            if (ssd != null) {
                                for (int j = 0; j < prevBranchHits.length; j++) {
                                    // returns -1 on an error condition.
                                    // probably never happens in normal
                                    // situation, but does in unit test.
                                    prevBranchHits[j] = Math.max(0,
                                            ssd.getHits(j));
                                }
                                prevDefaultHits = ssd.getDefaultHits();
                            }
                        }
                    }
                    for (int j = 0; j < prevBranchHits.length; j++) {
                        long diffBranchHits = lsd.getHits(j)
View Full Code Here

        for (int i = 0; i < 3; i++) {
            LineData x = bar.getLineCoverage(i);
            assertEquals(x.getHits(), 0);
            assertEquals(x.hasBranch(), i == 2, "Switches for " + i);
            if (x.hasBranch()) {
                SwitchData sd = (SwitchData) x.getConditionData(0);
                assertEquals(1, sd.getDefaultHits());
                assertEquals(0, sd.getHits(0));
                assertEquals(0, sd.getHits(1));
                assertEquals(1, sd.getHits(2));

            }
        }
        ClassData baz = diff.getClassData("baz");
        assertEquals(8, baz.getLines().size());
View Full Code Here

TOP

Related Classes of net.sourceforge.cobertura.coveragedata.SwitchData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.