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

Method testTreeSet

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

Source from the content-addressed store, hash-verified

136 }
137
138 private static final void testTreeSet() {
139 traceFunc("testTreeSet()");
140 TreeSet<Item> items = new TreeSet<Item>(new Comparator<Item>() {
141 public int compare(Item i1, Item i2) {
142 int r = i1.value() - i2.value();
143 if (r == 0) {
144 return i1.index() - i2.index();
145 }
146 return r;
147 }
148 });
149 for (int iter=0; iter < ITERATION_COUNT; iter++) {
150 for (int i=0; i < 1000; i++) {
151 items.add(new Item(1));
152 }
153 for (int i=0; i < 500; i++) {
154 items.add(new Item(4));
155 }
156 for (int i=0; i < 250; i++) {
157 items.add(new Item(9));
158 }
159 expect(runningSum(items) == (1000*1 + 500*4 + 250*9));
160 items.clear();
161 }
162 }
163
164 public static void main(String args[]) {
165 for (int i=0; i < 10; i++) {

Callers 1

mainMethod · 0.95

Calls 5

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

Tested by

no test coverage detected