source: mainline/uspace/lib/pcut/tests/preinithook.c@ d7f7a4a

Last change on this file since d7f7a4a was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 4 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 677 bytes
Line 
1/*
2 * SPDX-FileCopyrightText: 2014 Vojtech Horky
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <pcut/pcut.h>
8#include "tested.h"
9
10PCUT_INIT
11
12static int init_counter = 1;
13
14static void init_hook(void) {
15 init_counter++;
16}
17
18static void pre_init_hook(int *argc, char **argv[]) {
19 (void) argc;
20 (void) argv;
21 init_counter *= 2;
22}
23
24PCUT_TEST_BEFORE {
25 PCUT_ASSERT_INT_EQUALS(4, init_counter);
26 init_counter++;
27}
28
29PCUT_TEST(check_init_counter) {
30 PCUT_ASSERT_INT_EQUALS(5, init_counter);
31}
32
33PCUT_TEST(check_init_counter_2) {
34 PCUT_ASSERT_INT_EQUALS(5, init_counter);
35}
36
37
38PCUT_CUSTOM_MAIN(
39 PCUT_MAIN_SET_INIT_HOOK(init_hook),
40 PCUT_MAIN_SET_PREINIT_HOOK(pre_init_hook)
41)
42
Note: See TracBrowser for help on using the repository browser.