public class SetSortEncodingCountTest
extends junit.framework.TestCase
The encodings are now derived once and carried alongside the elements. This is asserted by counting, not by timing: the elements below record how often they are asked for their encoding, so the bound is exact and does not depend on how loaded the machine is. Note the sort is still O(N^2) in comparisons - that is the insertion sort itself, unchanged here.
| Constructor and Description |
|---|
SetSortEncodingCountTest() |
| Modifier and Type | Method and Description |
|---|---|
void |
testSortEncodesEachElementOnce() |
void |
testSortOrderUnchanged()
The compatibility assertion: memoising the encodings must not change the order they end up
in.
|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, setUp, tearDown, toStringpublic void testSortEncodesEachElementOnce()
throws java.io.IOException
java.io.IOExceptionpublic void testSortOrderUnchanged()
throws java.io.IOException
java.io.IOException