Subversion Repositories HelenOS

Rev

Rev 3386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3386 Rev 4263
Line 31... Line 31...
31
#include <adt/btree.h>
31
#include <adt/btree.h>
32
#include <debug.h>
32
#include <debug.h>
33
 
33
 
34
static void *data = (void *) 0xdeadbeef;
34
static void *data = (void *) 0xdeadbeef;
35
 
35
 
36
char * test_btree1(bool quiet)
36
char *test_btree1(void)
37
{
37
{
38
    btree_t t;
38
    btree_t t;
39
    int i;
39
    int i;
40
 
40
   
41
    btree_create(&t);
41
    btree_create(&t);
42
   
42
   
43
    if (!quiet)
-
 
44
        printf("Inserting keys.\n");
43
    TPRINTF("Inserting keys.\n");
45
    btree_insert(&t, 19, data, NULL);
44
    btree_insert(&t, 19, data, NULL);
46
    btree_insert(&t, 20, data, NULL);
45
    btree_insert(&t, 20, data, NULL);
47
    btree_insert(&t, 21, data, NULL);
46
    btree_insert(&t, 21, data, NULL);
48
    btree_insert(&t, 0, data, NULL);
47
    btree_insert(&t, 0, data, NULL);
49
    btree_insert(&t, 25, data, NULL);
48
    btree_insert(&t, 25, data, NULL);
Line 76... Line 75...
76
    for (i = 30; i < 50; i++)
75
    for (i = 30; i < 50; i++)
77
        btree_insert(&t, i, data, NULL);
76
        btree_insert(&t, i, data, NULL);
78
    for (i = 100; i >= 50; i--)
77
    for (i = 100; i >= 50; i--)
79
        btree_insert(&t, i, data, NULL);
78
        btree_insert(&t, i, data, NULL);
80
   
79
   
81
    if (!quiet)
80
    if (!test_quiet)
82
        btree_print(&t);
81
        btree_print(&t);
83
   
82
   
84
    if (!quiet)
-
 
85
        printf("Removing keys.\n");
83
    TPRINTF("Removing keys.\n");
86
    btree_remove(&t, 50, NULL);
84
    btree_remove(&t, 50, NULL);
87
    btree_remove(&t, 49, NULL);
85
    btree_remove(&t, 49, NULL);
88
    btree_remove(&t, 51, NULL);
86
    btree_remove(&t, 51, NULL);
89
    btree_remove(&t, 46, NULL);
87
    btree_remove(&t, 46, NULL);
90
    btree_remove(&t, 45, NULL);
88
    btree_remove(&t, 45, NULL);
Line 156... Line 154...
156
    btree_remove(&t, 39, NULL);
154
    btree_remove(&t, 39, NULL);
157
    btree_remove(&t, 34, NULL);
155
    btree_remove(&t, 34, NULL);
158
    btree_remove(&t, 35, NULL);
156
    btree_remove(&t, 35, NULL);
159
    btree_remove(&t, 36, NULL);
157
    btree_remove(&t, 36, NULL);
160
   
158
   
161
    if (!quiet)
159
    if (!test_quiet)
162
        btree_print(&t);
160
        btree_print(&t);
163
   
161
   
164
    return NULL;
162
    return NULL;
165
}
163
}