/*******************************************************************************
 * Copyright 2017
 * Language Technology Lab
 * University of Duisburg-Essen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/

package de.unidue.ltl.evaluation.significance;

import static org.junit.Assert.*;

import org.junit.Test;

import de.unidue.ltl.evaluation.Evaluation;
import de.unidue.ltl.evaluation.significance.McNemarTest;

public class McNemareTestUnitTest {

	@Test
	public void mcnemareSignificanceTest() {
		Evaluation<String> evaluation1 = new Evaluation<String>();
		for (int i = 0; i < 8; i++) {
			evaluation1.register("A", "A");
		}
		for (int i = 0; i < 16; i++) {
			evaluation1.register("A", "B");
		}

		Evaluation<String> evaluation2 = new Evaluation<String>();
		for (int i = 0; i < 11; i++) {
			evaluation2.register("A", "A");
		}
		for (int i = 0; i < 5; i++) {
			evaluation2.register("A", "B");
		}

		assertEquals(5.25, McNemarTest.computeSignificance(evaluation1, evaluation2), 0.001);
	}

}

@@ -1148,34 +1148,94 @@
 g%3E();%0A%09%09
+Evaluation%3CString%3E evaluation2 = new Evaluation%3CString%3E();%0A%09%09%0A%09%09
 for
- 
 (int i
- = 
+=
 0; i
- 
 %3C 8; i++
@@ -1231,25 +1231,24 @@
 ; i%3C 8; i++)
- 
 %7B%0A%09%09%09evaluat
@@ -1276,43 +1276,76 @@
 %22);%0A
+%09%09%09evaluation2.register(%22A%22, %22A%22);%0A
 %09%09%7D%0A
+%09%09%0A
 %09%09for
- 
 (int i
- = 
+=
 0; i
- 
 %3C 1
-6
+1
 ; i++)
- 
 %7B%0A%09%09
@@ -1383,104 +1383,110 @@
 ;%0A%09%09
-%7D%0A%0A%09%09Evaluation%3CString%3E evaluation2 = new Evaluation%3CString%3E();
+%09evaluation2.register(%22A%22, %22B%22);%0A%09%09%7D%0A%09%09
 %0A%09%09for
- 
 (int i
- = 
+=
 0; i
- 
 %3C 1
-1
+6
 ; i++)
- 
 %7B
+%0A%09%09%09evaluation1.register(%22A%22, %22B%22);
 %0A%09%09%09
@@ -1525,28 +1525,27 @@
 %09%09%7D%0A
+%09%09%0A
 %09%09for
- 
 (int i
- = 
+=
 0; i
- 
 %3C 5;
@@ -1549,17 +1549,16 @@
  5; i++)
- 
 %7B%0A%09%09%09eva
@@ -1568,34 +1568,152 @@
 tion
-2.register(%22A%22, %22B%22);%0A%09%09%7D%0A
+1.register(%22A%22, %22A%22);%0A%09%09%09evaluation2.register(%22A%22, %22B%22);%0A%09%09%7D%0A%09%09%0A%09%09System.out.println(McNemarTest.computeSignificance(evaluation1, evaluation2));
 %0A%09%09a
@@ -1797,14 +1797,17 @@
 0.001);%0A
+%09%09%0A
 %09%7D%0A%0A%7D%0A

update mcNemar test example