public void testUInt_withValidator() { final int[][] values = new int[][] { TestHelper.createUInts( new long[] { 2147483644L, 2147483645L, 2147483646L, 2147483647L, 2147483648L, 2147483649L, 2147483650L, 2147483651L }), TestHelper.createUInts(new long[] {2147483645L, 2147483647L, 2147483649L, 2147483651L}), TestHelper.createUInts(new long[] {2147483647L, 2147483648L, 2147483649L}) }; final boolean unsigned = true; final IndexValidator validator = new IndexValidator() { public boolean validateIndex(int index) { return index % 3 != 0; } }; final Histogram histogram = new Histogram(new int[6], 2147483645, 2147483650L); for (int i = 0; i < values.length; i++) { histogram.aggregate(values[i], unsigned, validator, ProgressMonitor.NULL); } final int[] exp = new int[] {1, 1, 1, 2, 3, 0}; assertEquals("", equal(exp, histogram.getBinCounts())); }
public void testUInt() { final int[][] values = new int[][] { TestHelper.createUInts( new long[] { 2147483644L, 2147483645L, 2147483646L, 2147483647L, 2147483648L, 2147483649L, 2147483650L, 2147483651L }), TestHelper.createUInts(new long[] {2147483645L, 2147483647L, 2147483649L, 2147483651L}), TestHelper.createUInts(new long[] {2147483647L, 2147483648L, 2147483649L}) }; final boolean unsigned = true; final Histogram histogram = new Histogram(new int[6], 2147483645, 2147483650L); for (int i = 0; i < values.length; i++) { histogram.aggregate(values[i], unsigned, IndexValidator.TRUE, ProgressMonitor.NULL); } final int[] exp = new int[] {2, 1, 3, 2, 3, 1}; assertEquals("", equal(exp, histogram.getBinCounts())); }