package com.bbn.bue.common.diff;

import com.bbn.bue.common.evaluation.FMeasureCounts;
import com.google.common.collect.ImmutableMap;
import org.junit.Test;

import java.util.Map;

import static org.junit.Assert.assertEquals;

public class FMeasureTableRendererTest {
    @Test
    public void testFMeasureTableRenderer() {
        final FMeasureTableRenderer renderer = FMeasureTableRenderer.create();

        final Map<String, FMeasureCounts> data = ImmutableMap.of(
                "foo", FMeasureCounts.from(1, 2, 3),
                "bar", FMeasureCounts.from(4, 5, 6));

        final String expected=
                "Name                            TP       FP       FN        P        R       F1\n"+
                "===============================================================================\n"+
                "foo                            1.0      2.0      3.0    33.33    25.00    28.57\n"+
                "bar                            4.0      5.0      6.0    44.44    40.00    42.11\n";
        final String result = renderer.render(data);
        assertEquals(expected, result);
    }
}

@@ -821,19 +821,19 @@
        %22
-foo
+bar
         
@@ -856,17 +856,17 @@
     
-1
+4
 .0      
 2.0 
@@ -865,17 +865,17 @@
     
-2
+5
 .0      
 3.0 
@@ -874,38 +874,38 @@
     
-3
+6
 .0    
-33.33
+44.44
     
-25
+40
 .00    
-28.57
+42.11
 %5Cn%22+
@@ -914,35 +914,35 @@
                %22
-bar
+foo
                 
@@ -949,33 +949,33 @@
             
-4
+1
 .0      
 5.0      6.0
@@ -958,33 +958,33 @@
    1.0      
-5
+2
 .0      
 6.0    44.44
@@ -975,43 +975,44 @@
     
-6
+3
 .0    
-44.44
+33.33
     
-40
+25
 .00    
-42.11
+28.57
 %5Cn%22;%0A
+%0A
     

Change test due to change in default sort order.