Lines Matching defs:pq
58 nghttp2_pq pq;
61 nghttp2_pq_init(&pq, pq_less, nghttp2_mem_default());
62 CU_ASSERT(nghttp2_pq_empty(&pq));
63 CU_ASSERT(0 == nghttp2_pq_size(&pq));
64 CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("foo")->ent));
65 CU_ASSERT(0 == nghttp2_pq_empty(&pq));
66 CU_ASSERT(1 == nghttp2_pq_size(&pq));
67 top = (string_entry *)nghttp2_pq_top(&pq);
69 CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("bar")->ent));
70 top = (string_entry *)nghttp2_pq_top(&pq);
72 CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("baz")->ent));
73 top = (string_entry *)nghttp2_pq_top(&pq);
75 CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("C")->ent));
76 CU_ASSERT(4 == nghttp2_pq_size(&pq));
78 top = (string_entry *)nghttp2_pq_top(&pq);
81 nghttp2_pq_pop(&pq);
83 CU_ASSERT(3 == nghttp2_pq_size(&pq));
85 top = (string_entry *)nghttp2_pq_top(&pq);
87 nghttp2_pq_pop(&pq);
90 top = (string_entry *)nghttp2_pq_top(&pq);
92 nghttp2_pq_pop(&pq);
95 top = (string_entry *)nghttp2_pq_top(&pq);
97 nghttp2_pq_pop(&pq);
100 CU_ASSERT(nghttp2_pq_empty(&pq));
101 CU_ASSERT(0 == nghttp2_pq_size(&pq));
102 CU_ASSERT(NULL == nghttp2_pq_top(&pq));
106 CU_ASSERT(0 == nghttp2_pq_push(&pq, &string_entry_new("foo")->ent));
107 CU_ASSERT((size_t)(i + 1) == nghttp2_pq_size(&pq));
110 top = (string_entry *)nghttp2_pq_top(&pq);
112 nghttp2_pq_pop(&pq);
114 CU_ASSERT((size_t)(i - 1) == nghttp2_pq_size(&pq));
117 nghttp2_pq_free(&pq);
145 nghttp2_pq pq;
151 nghttp2_pq_init(&pq, node_less, nghttp2_mem_default());
156 nghttp2_pq_push(&pq, &nodes[i].ent);
159 nghttp2_pq_update(&pq, node_update, NULL);
162 nd = (node *)nghttp2_pq_top(&pq);
164 nghttp2_pq_pop(&pq);
167 nghttp2_pq_free(&pq);
170 static void push_nodes(nghttp2_pq *pq, node *dest, size_t n) {
175 nghttp2_pq_push(pq, &dest[i].ent);
179 static void check_nodes(nghttp2_pq *pq, size_t n, int *ans_key, int *ans_val) {
182 node *nd = (node *)nghttp2_pq_top(pq);
185 nghttp2_pq_pop(pq);
190 nghttp2_pq pq;
199 nghttp2_pq_init(&pq, node_less, nghttp2_mem_default());
201 push_nodes(&pq, nodes, 6);
203 nghttp2_pq_remove(&pq, &nodes[0].ent);
205 check_nodes(&pq, 5, ans_key1, ans_val1);
207 nghttp2_pq_free(&pq);
209 nghttp2_pq_init(&pq, node_less, nghttp2_mem_default());
211 push_nodes(&pq, nodes, 6);
213 nghttp2_pq_remove(&pq, &nodes[3].ent);
215 check_nodes(&pq, 5, ans_key2, ans_val2);
217 nghttp2_pq_free(&pq);
219 nghttp2_pq_init(&pq, node_less, nghttp2_mem_default());
221 push_nodes(&pq, nodes, 6);
223 nghttp2_pq_remove(&pq, &nodes[5].ent);
225 check_nodes(&pq, 5, ans_key3, ans_val3);
227 nghttp2_pq_free(&pq);