EMMA Coverage Report (generated Sat Aug 20 11:00:51 CDT 2011)
[all classes][felix.test]

COVERAGE SUMMARY FOR SOURCE FILE [CorefTest.java]

nameclass, %method, %block, %line, %
CorefTest.java100% (1/1)100% (3/3)78%  (201/258)80%  (36.7/46)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CorefTest100% (1/1)100% (3/3)78%  (201/258)80%  (36.7/46)
testCorefMAP (): void 100% (1/1)77%  (191/248)78%  (33.7/43)
<static initializer> 100% (1/1)100% (7/7)100% (3/3)
CorefTest (): void 100% (1/1)100% (3/3)100% (1/1)

1package felix.test;
2 
3import static org.junit.Assert.*;
4 
5import java.io.BufferedReader;
6import java.io.FileReader;
7import java.util.ArrayList;
8import java.util.HashMap;
9import java.util.HashSet;
10import java.util.regex.Matcher;
11import java.util.regex.Pattern;
12 
13import org.junit.Test;
14 
15import tuffy.util.UIMan;
16import felix.main.Felix;
17import felix.parser.FelixCommandOptions;
18import felix.util.FelixConfig;
19import felix.util.FelixUIMan;
20 
21/**
22 * Test Coref operator's quality.
23 * @author Ce Zhang
24 *
25 */
26public class CorefTest{
27        
28        public static ArrayList<Double> planCosts = new ArrayList<Double>();
29        public static String exeTime = "";
30                
31        /**
32         * Test Coref's quality on a test case which has manually-built ground truth.
33         */
34        @Test
35        public final void testCorefMAP() {
36                try{
37                        String[] args = {"-e", "test/felix/coref_test/evid.db", "-i", "test/felix/coref_test/prog.mln",
38                                        "-o", "test/testOutput.txt_coref", "-queryFile", "test/felix/coref_test/query.db", "-keepData"};
39                        
40                        for(int wwww = 0; wwww < 2; wwww++){
41                                
42                                FelixConfig.overrideID();
43                                FelixCommandOptions options = FelixUIMan.parseCommand(args);
44                                
45                                if(wwww == 1){
46                                        options.useDualDecomposition = true;
47                                        FelixConfig.nDDIT = 2;
48                                }
49                                
50                                String outfile = "test/testOutput.txt_coref";
51                                
52                                if(wwww == 1){
53                                        outfile = outfile + "_snap_0";
54                                }
55                                
56                                
57                                new Felix().run(options);
58                                
59                                BufferedReader br = new BufferedReader(new FileReader(outfile));
60                                Pattern p = Pattern.compile("coref_map\\(\"(.*?)\", \"(.*?)\"\\)");
61                                String line;
62                                Integer five = -1;
63                                Integer six = -1;
64                                while( (line = br.readLine()) != null ){
65                                        Matcher m = p.matcher(line);
66                                        m.find();
67                                        Integer n1 = Integer.valueOf(m.group(1));
68                                        Integer n2 = Integer.valueOf(m.group(2));
69                                        if(n1 != n2){
70                                                if(n1 == 1 || n1 == 2 || n1 == 3 || n1 == 9){
71                                                        assertTrue(n2 == 1 || n2 == 2 || n2 == 3 || n2 == 9);
72                                                }else if(n1 ==4 || n1 ==5 || n1 ==6){
73                                                        assertTrue(n2 == 4 || n2 ==5 || n2 ==6);
74                                                }else if(n1 == 7){
75                                                        assertTrue(n2 == 7);
76                                                }else if(n1 == 8){
77                                                        assertTrue(n2 == 8);
78                                                }else{
79                                                        assertTrue(false);
80                                                }
81                                        }
82                                        
83                                        if(n1 == 5){
84                                                five = n2;
85                                        }
86                                        if(n1 == 6){
87                                                six = n2;
88                                        }
89                                }
90                                
91                                System.out.println(five);
92                                System.out.println(six);
93                                System.out.println(five.equals(six));
94                                assertFalse(five.equals(six));
95                                
96                        }
97                        
98                }catch(Exception e){
99                        e.printStackTrace();
100                        assertTrue(false);
101                }
102        }
103        
104        
105        
106}
107 
108 
109 
110 
111 
112 

[all classes][felix.test]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov