]>
Dogcows Code - chaz/openbox/blob - obt/tests/bstest.c
5 gcc
-O0
-o
./bstest `pkg
-config
--cflags
--libs obt
-3.5` bstest
.c
&& \
10 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
12 bstest.c for the Openbox window manager
13 Copyright (c) 2010 Dana Jansens
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.
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.
25 See the COPYING file for a copy of the GNU General Public License.
28 #include "../bsearch.h"
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]);
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
);
This page took 0.037804 seconds and 4 git commands to generate.