X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=tests%2Fprioq-test.c;h=d9f9f19546dcc85a152df0cb56b175ec8a40b5f8;hb=de2b14e15ff63cfd0218691532e7c7e9153f7c04;hp=99225653936b499b2ecf1d9114d021cf4c6b73ec;hpb=5133886fe11d7650bc89b46746731ca2eab2185d;p=catta diff --git a/tests/prioq-test.c b/tests/prioq-test.c index 9922565..d9f9f19 100644 --- a/tests/prioq-test.c +++ b/tests/prioq-test.c @@ -1,18 +1,18 @@ /*** - This file is part of avahi. + This file is part of catta. - avahi is free software; you can redistribute it and/or modify it + catta is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. - avahi is distributed in the hope that it will be useful, but WITHOUT + catta is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with avahi; if not, write to the Free Software + License along with catta; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. ***/ @@ -26,9 +26,9 @@ #include #include -#include +#include -#include +#include "../src/prioq.h" #define POINTER_TO_INT(p) ((int) (long) (p)) #define INT_TO_POINTER(i) ((void*) (long) (i)) @@ -43,7 +43,7 @@ static int compare_ptr(const void* a, const void* b) { return a < b ? -1 : (a > b ? 1 : 0); } -static void rec(AvahiPrioQueueNode *n) { +static void rec(CattaPrioQueueNode *n) { if (!n) return; @@ -80,17 +80,17 @@ static void rec(AvahiPrioQueueNode *n) { rec(n->right); } -int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { - AvahiPrioQueue *q, *q2; +int main(CATTA_GCC_UNUSED int argc, CATTA_GCC_UNUSED char *argv[]) { + CattaPrioQueue *q, *q2; int i; - q = avahi_prio_queue_new(compare_int); - q2 = avahi_prio_queue_new(compare_ptr); + q = catta_prio_queue_new(compare_int); + q2 = catta_prio_queue_new(compare_ptr); srand(time(NULL)); for (i = 0; i < 10000; i++) - avahi_prio_queue_put(q2, avahi_prio_queue_put(q, INT_TO_POINTER(random() & 0xFFFF))); + catta_prio_queue_put(q2, catta_prio_queue_put(q, INT_TO_POINTER(rand() & 0xFFFF))); while (q2->root) { rec(q->root); @@ -98,10 +98,10 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { assert(q->n_nodes == q2->n_nodes); - printf("%i\n", POINTER_TO_INT(((AvahiPrioQueueNode*)q2->root->data)->data)); + printf("%i\n", POINTER_TO_INT(((CattaPrioQueueNode*)q2->root->data)->data)); - avahi_prio_queue_remove(q, q2->root->data); - avahi_prio_queue_remove(q2, q2->root); + catta_prio_queue_remove(q, q2->root->data); + catta_prio_queue_remove(q2, q2->root); } @@ -110,11 +110,11 @@ int main(AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { /* int v = GPOINTER_TO_INT(q->root->data); */ /* rec(q->root); */ /* printf("%i\n", v); */ -/* avahi_prio_queue_remove(q, q->root); */ +/* catta_prio_queue_remove(q, q->root); */ /* assert(v >= prev); */ /* prev = v; */ /* } */ - avahi_prio_queue_free(q); + catta_prio_queue_free(q); return 0; }