MCPcopy Create free account
hub / github.com/ReadyTalk/avian / testLinkedList

Method testLinkedList

test/extra/Memory.java:112–136  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110 }
111
112 private static final void testLinkedList() {
113 traceFunc("testLinkedList()");
114 LinkedList<Item> items = new LinkedList<Item>();
115 for (int iter=0; iter < ITERATION_COUNT; iter++) {
116 for (int i=0; i < 1000; i++) {
117 items.add(new Item(1));
118 }
119 for (int i=0; i < 500; i++) {
120 items.add(new Item(4));
121 }
122 for (int i=0; i < 250; i++) {
123 items.add(new Item(9));
124 }
125 expect(runningSum(items) == (1000*1 + 500*4 + 250*9));
126 for (int i = 1199; i >= 900; i--) {
127 items.remove(i);
128 }
129 expect(runningSum(items) == (900*1 + 300*4 + 250*9));
130 for (int i = 900; i < 1200; i++) {
131 items.add(new Item(i < 1000 ? 1 : 4));
132 }
133 expect(runningSum(items) == (1000*1 + 500*4 + 250*9));
134 items.clear();
135 }
136 }
137
138 private static final void testTreeSet() {
139 traceFunc("testTreeSet()");

Callers 1

mainMethod · 0.95

Calls 6

traceFuncMethod · 0.95
addMethod · 0.95
expectMethod · 0.95
runningSumMethod · 0.95
removeMethod · 0.95
clearMethod · 0.95

Tested by

no test coverage detected