Search in sources :

Example 11 with TestSuite

use of org.kanonizo.framework.objects.TestSuite in project kanonizo by kanonizo.

the class Mutation method parseKillMap.

private static void parseKillMap(File kill, TestSuite testSuite) {
    CSVParser parser = null;
    try {
        parser = new CSVParser(new FileReader(kill), CSVFormat.DEFAULT);
        for (CSVRecord record : parser.getRecords()) {
            if (record.getRecordNumber() == 0) {
                continue;
            }
            int testCase = Integer.parseInt(record.get(0));
            int mutantKilled = Integer.parseInt(record.get(1));
            TestCase test = testSuite.getOriginalOrdering().get(testCase - 1);
            if (!killMap.containsKey(test)) {
                killMap.put(test, new ArrayList<Mutant>());
            }
            killMap.get(test).addAll(getMutants(mutant -> mutant.getMutantId() == mutantKilled));
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        try {
            parser.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
Also used : TestSuite(org.kanonizo.framework.objects.TestSuite) Predicate(java.util.function.Predicate) CSVRecord(org.apache.commons.csv.CSVRecord) Scanner(java.util.Scanner) IOException(java.io.IOException) HashMap(java.util.HashMap) Parameter(com.scythe.instrumenter.InstrumentationProperties.Parameter) Collectors(java.util.stream.Collectors) File(java.io.File) FileNotFoundException(java.io.FileNotFoundException) ArrayList(java.util.ArrayList) TestCase(org.kanonizo.framework.objects.TestCase) List(java.util.List) Util(org.kanonizo.util.Util) CSVFormat(org.apache.commons.csv.CSVFormat) ClassAnalyzer(com.scythe.instrumenter.analysis.ClassAnalyzer) Map(java.util.Map) CSVParser(org.apache.commons.csv.CSVParser) FileReader(java.io.FileReader) TestCase(org.kanonizo.framework.objects.TestCase) CSVParser(org.apache.commons.csv.CSVParser) FileNotFoundException(java.io.FileNotFoundException) FileReader(java.io.FileReader) CSVRecord(org.apache.commons.csv.CSVRecord) IOException(java.io.IOException)

Aggregations

TestSuite (org.kanonizo.framework.objects.TestSuite)11 TestCase (org.kanonizo.framework.objects.TestCase)5 ArrayList (java.util.ArrayList)4 Parameter (com.scythe.instrumenter.InstrumentationProperties.Parameter)1 ClassAnalyzer (com.scythe.instrumenter.analysis.ClassAnalyzer)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Scanner (java.util.Scanner)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 CSVFormat (org.apache.commons.csv.CSVFormat)1 CSVParser (org.apache.commons.csv.CSVParser)1 CSVRecord (org.apache.commons.csv.CSVRecord)1 StoppingCondition (org.kanonizo.algorithms.stoppingconditions.StoppingCondition)1 Display (org.kanonizo.display.Display)1