]>
git.proxmox.com Git - mirror_frr.git/blob - tests/lib/test_assert.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Quick test for assert()
4 * Copyright (C) 2021 David Lamparter for NetDEF, Inc.
11 /* make sure this works with assert.h & nothing else. also check the include
12 * shadowing, we don't want to pick up system assert.h
16 __attribute__((noinline
))
17 static void func_for_bt(int number
)
20 assertf(number
> 3, "(A) the number was %d", number
);
25 #include "lib/thread.h"
26 #include "lib/sigevent.h"
28 int main(int argc
, char **argv
)
31 struct thread_master
*master
;
33 zlog_aux_init("NONE: ", LOG_DEBUG
);
36 number
= atoi(argv
[1]);
39 assertf(number
> 1, "(B) the number was %d", number
);
41 /* set up SIGABRT handler */
42 master
= thread_master_create("test");
43 signal_init(master
, 0, NULL
);
47 assertf(number
> 5, "(C) the number was %d", number
);
49 assertf(number
> 10, "(D) the number was %d", number
);