MCPcopy Create free account
hub / github.com/GCMiner/GCMiner / testCompare

Method testCompare

src/test/java/examples/CalendarTest.java:26–38  ·  view source on GitHub ↗
(@Size(max=100) List<@From(CalendarGenerator.class) GregorianCalendar> cals)

Source from the content-addressed store, hash-verified

24 }
25
26 @Fuzz
27 public void testCompare(@Size(max=100) List<@From(CalendarGenerator.class) GregorianCalendar> cals) {
28 // Sort list of calendar objects using our custom comparator function
29 Collections.sort(cals, CalendarLogic::compare);
30
31 // If they have an ordering, then the sort should succeed
32 for (int i = 1; i < cals.size(); i++) {
33 Calendar c1 = cals.get(i-1);
34 Calendar c2 = cals.get(i);
35 assumeFalse(c1.equals(c2)); // Assume that we have distinct dates
36 assertTrue(c1 + " should be before " + c2, c1.before(c2)); // Then c1 < c2
37 }
38 }
39}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected