]> icculus.org git repositories - dana/openbox.git/blob - obt/tests/bstest.c
Add include of cairo.h when using librsvg
[dana/openbox.git] / obt / tests / bstest.c
1 #/*
2 #!/bin/sh
3 #*/
4 #if 0
5 gcc -O0 -o ./bstest `pkg-config --cflags --libs obt-3.5` bstest.c && \
6 ./bstest
7 exit
8 #endif
9
10 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
11
12    bstest.c for the Openbox window manager
13    Copyright (c) 2010        Dana Jansens
14
15    This program is free software; you can redistribute it and/or modify
16    it under the terms of the GNU General Public License as published by
17    the Free Software Foundation; either version 2 of the License, or
18    (at your option) any later version.
19
20    This program is distributed in the hope that it will be useful,
21    but WITHOUT ANY WARRANTY; without even the implied warranty of
22    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23    GNU General Public License for more details.
24
25    See the COPYING file for a copy of the GNU General Public License.
26 */
27
28 #include "../bsearch.h"
29 #include <stdio.h>
30
31 int main() {
32     int ar[] = {
33         2, 4, 5, 7, 12, 34, 45, 56, 57, 67, 67, 68, 68, 69, 70, 71, 89, 100 };
34     int n = sizeof(ar)/sizeof(ar[0]);
35     BSEARCH_SETUP(int);
36     BSEARCH(int, ar, 0, n, 1);
37     g_assert(!!BSEARCH_FOUND() == FALSE);
38     BSEARCH(int, ar, 0, n, 0);
39     g_assert(!!BSEARCH_FOUND() == FALSE);
40     BSEARCH(int, ar, 0, n, 2);
41     g_assert(!!BSEARCH_FOUND() == TRUE);
42     g_assert(BSEARCH_AT() == 0);
43     BSEARCH(int, ar, 0, n, 58);
44     g_assert(!!BSEARCH_FOUND() == FALSE);
45     BSEARCH(int, ar, 0, n, 57);
46     g_assert(!!BSEARCH_FOUND() == TRUE);
47     g_assert(BSEARCH_AT() == 8);
48     BSEARCH(int, ar, 0, n, 55);
49     g_assert(!!BSEARCH_FOUND() == FALSE);
50     BSEARCH(int, ar, 0, n, 99);
51     g_assert(!!BSEARCH_FOUND() == FALSE);
52     BSEARCH(int, ar, 0, n, 100);
53     g_assert(!!BSEARCH_FOUND() == TRUE);
54     g_assert(BSEARCH_AT() == 17);
55     BSEARCH(int, ar, 0, n, 101);
56     g_assert(!!BSEARCH_FOUND() == FALSE);
57     g_print("ok\n");
58 }