Subversion Repositories HelenOS-historic

Rev

Rev 1142 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (C) 2006 Jakub Jermar
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. #include <test.h>
  30. #include <print.h>
  31. #include <adt/btree.h>
  32. #include <debug.h>
  33.  
  34. void *data = (void *) 0xdeadbeef;
  35.  
  36. void test(void)
  37. {
  38.     btree_t t;
  39.     int i;
  40.  
  41.     btree_create(&t);
  42.  
  43.     btree_insert(&t, 23, data, NULL);
  44.     btree_insert(&t, 24, data, NULL);
  45.     btree_insert(&t, 5, data, NULL);
  46.     btree_insert(&t, 1, data, NULL);
  47.     btree_insert(&t, 4, data, NULL);
  48.     btree_insert(&t, 28, data, NULL);
  49.     btree_insert(&t, 29, data, NULL);
  50.     btree_insert(&t, 7, data, NULL);
  51.     btree_insert(&t, 8, data, NULL);
  52.     btree_insert(&t, 9, data, NULL);
  53.     btree_insert(&t, 17, data, NULL);
  54.     btree_insert(&t, 18, data, NULL);
  55.     btree_insert(&t, 2, data, NULL);
  56.     btree_insert(&t, 3, data, NULL);
  57.     btree_insert(&t, 6, data, NULL);
  58.     btree_insert(&t, 19, data, NULL);
  59.     btree_insert(&t, 20, data, NULL);
  60.     btree_insert(&t, 21, data, NULL);
  61.     btree_insert(&t, 0, data, NULL);
  62.     btree_insert(&t, 25, data, NULL);
  63.     btree_insert(&t, 22, data, NULL);
  64.     btree_insert(&t, 26, data, NULL);
  65.     btree_insert(&t, 10, data, NULL);
  66.     btree_insert(&t, 11, data, NULL);
  67.     btree_insert(&t, 12, data, NULL);
  68.     btree_insert(&t, 13, data, NULL);
  69.     btree_insert(&t, 14, data, NULL);
  70.     btree_insert(&t, 15, data, NULL);
  71.     btree_insert(&t, 16, data, NULL);
  72.     btree_insert(&t, 27, data, NULL);
  73.  
  74.     for (i = 30; i < 50; i++)
  75.         btree_insert(&t, i, data, NULL);
  76.     for (i = 100; i >= 50; i--)
  77.         btree_insert(&t, i, data, NULL);
  78.  
  79.     btree_print(&t);
  80.  
  81. }
  82.