private static Set<Integer> set(int... values) { return new HashSet<>(asList(values)) ; }
private static void test(Set<Integer> x, int...values) { List<Integer> y = asList(values) ; assertEquals(y.size(), x.size()) ; for ( Integer aY : y ) { assertTrue( x.contains( aY ) ); } } }
public static void testIndexContents(Index index, int... records) { List<Integer> x = toIntList(index.iterator()) ; // Make a unique list of expected records. Remove duplicates List<Integer> y = unique(asList(records)) ; assertEquals("Expected records size and tree size different", y.size(), index.size()) ; assertEquals("Expected records size and iteration over all keys are of different sizes", y.size(), x.size()) ; if ( index instanceof RangeIndex ) { // Check sorted order for ( int i = 0 ; i < x.size() - 2 ; i++ ) { if ( x.get(i) > x.get(i + 1) ) { fail("check failed: " + strings(records)) ; return ; } } } // Check each expected record is in the tree for ( int k : y ) { Record rec = intToRecord(k) ; Record r2 = index.find(rec) ; assertNotNull(r2) ; } } }
public static void testIndexContents(Index index, int... records) { List<Integer> x = toIntList(index.iterator()) ; // Make a unique list of expected records. Remove duplicates List<Integer> y = unique(asList(records)) ; assertEquals("Expected records size and tree size different", y.size(), index.size()) ; assertEquals("Expected records size and iteration over all keys are of different sizes", y.size(), x.size()) ; if ( index instanceof RangeIndex ) { // Check sorted order for ( int i = 0 ; i < x.size() - 2 ; i++ ) { if ( x.get(i) > x.get(i + 1) ) { fail("check failed: " + strings(records)) ; return ; } } } // Check each expected record is in the tree for ( int k : y ) { Record rec = intToRecord(k) ; Record r2 = index.find(rec) ; assertNotNull(r2) ; } } }
public static void check(ExtHash extHash, int...recs) { extHash.check(); for ( int i : recs ) { Record r = intToRecordKey(i) ; assertNotNull(extHash.find(r)) ; } List<Integer> y = unique(asList(recs)) ; int x = (int)extHash.size() ; assertEquals(y.size(), x); }
public static void check(ExtHash extHash, int...recs) { extHash.check(); for ( int i : recs ) { Record r = intToRecordKey(i) ; assertNotNull(extHash.find(r)) ; } List<Integer> y = unique(asList(recs)) ; int x = (int)extHash.size() ; assertEquals(y.size(), x); }
List<Integer> y = unique(asList(records)) ;
List<Integer> y = unique(asList(records)) ;