@@ -0,0 +1,1174 @@
+package refdiff.util;%0A%0Aimport static org.hamcrest.CoreMatchers.*;%0Aimport static org.junit.Assert.*;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Collections;%0A%0Aimport org.junit.Test;%0A%0Aimport refdiff.core.util.Statistics;%0A%0Apublic class TestStatistics %7B%0A%09%0A%09@Test%0A%09public void shouldComputeMedian() %7B%0A%09%09assertThat(%0A%09%09%09Statistics.median(Arrays.asList(1.0)),%0A%09%09%09is(1.0));%0A%09%09%0A%09%09assertThat(%0A%09%09%09Statistics.median(Arrays.asList(1.0, 2.0)),%0A%09%09%09is(1.5));%0A%09%09%0A%09%09assertThat(%0A%09%09%09Statistics.median(Arrays.asList(1.0, 2.0, 3.0)),%0A%09%09%09is(2.0));%0A%09%09%0A%09%09assertThat(%0A%09%09%09Statistics.median(Arrays.asList(1.0, 2.0, 2.2, 4.0)),%0A%09%09%09is(2.1));%0A%09%7D%0A%0A%09@Test%0A%09public void shouldComputeQ1AndQ3() %7B%0A%09%09assertThat(%0A%09%09%09Statistics.q1(Arrays.asList(1.0, 2.0)),%0A%09%09%09is(1.0));%0A%09%09%0A%09%09assertThat(%0A%09%09%09Statistics.q3(Arrays.asList(1.0, 2.0)),%0A%09%09%09is(2.0));%0A%09%09%0A%09%09assertThat(%0A%09%09%09Statistics.q1(Arrays.asList(1.0, 2.0, 3.0, 4.0, 5.0)),%0A%09%09%09is(1.5));%0A%09%09%0A%09%09assertThat(%0A%09%09%09Statistics.q3(Arrays.asList(1.0, 2.0, 3.0, 4.0, 5.0)),%0A%09%09%09is(4.5));%0A%09%7D%0A%09%0A%09@Test%0A%09public void shouldNotComputeMedianOfEmptyList() %7B%0A%09%09try %7B%0A%09%09%09Statistics.median(Collections.emptyList());%0A%09%09%09fail();%0A%09%09%7D catch (IllegalArgumentException e) %7B%0A%09%09%09// expected%0A%09%09%7D%0A%09%7D%0A%09%0A%7D%0A

Add TestStatistics