Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.6 kB
2
Indexable
Never
public void testIsAscendingBasic() {
		assertFalse(ListOfListService.isAscending(emptyList, 0));

		assertFalse(ListOfListService.isAscending(oneRow, 0));
		assertFalse(ListOfListService.isAscending(oneRow, 1));
		assertFalse(ListOfListService.isAscending(oneRow, -1));

		assertTrue(ListOfListService.isAscending(list2, 0));
		assertFalse(ListOfListService.isAscending(list2, 1));
		assertFalse(ListOfListService.isAscending(list2, 2));
		assertTrue(ListOfListService.isAscending(list2, 3));
		assertTrue(ListOfListService.isAscending(list2, 4));
		assertTrue(ListOfListService.isAscending(list2, 5));

		list2.get(4).set(1, 20); // 20, 20
		assertTrue(ListOfListService.isAscending(list2, 4));

		assertTrue(ListOfListService.isAscending(list1, 1));

		assertTrue(ListOfListService.isAscending(list3_emptySubLists, 0)); // empty sub-list is ascending
		assertFalse(ListOfListService.isAscending(list3_emptySubLists, 1));
		currentMethodName = new Throwable().getStackTrace()[0].getMethodName();
	}

	@Test @Graded(description="IsAscendingComprehensive", marks=2)
	public void testIsAscendingComprehensive() {
		testIsAscendingBasic();
		assertFalse(ListOfListService.isAscending(null, 0));

		assertFalse(ListOfListService.isAscending(list4_nullItems, 0));
		assertTrue(ListOfListService.isAscending(list4_nullItems, 2));
		assertFalse(ListOfListService.isAscending(list4_nullItems, 3));
		assertFalse(ListOfListService.isAscending(list4_nullItems, 5));
		currentMethodName = new Throwable().getStackTrace()[0].getMethodName();
	}