BRL-CAD
test_internals.h
Go to the documentation of this file.
1 /* T E S T _ I N T E R N A L S . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 
22 #ifndef LIBBU_TESTS_TEST_INTERNALS_H
23 #define LIBBU_TESTS_TEST_INTERNALS_H
24 
25 #include "bu/bitv.h"
26 #include "bu/log.h"
27 #include "bu/vls.h"
28 
30 #ifndef BU_TESTS_EXPORT
31 # if defined(BU_TESTS_DLL_EXPORTS) && defined(BU_TESTS_DLL_IMPORTS)
32 # error "Only BU_TESTS_DLL_EXPORTS or BU_TESTS_DLL_IMPORTS can be defined, not both."
33 # elif defined(BU_TESTS_DLL_EXPORTS)
34 # define BU_TESTS_EXPORT __declspec(dllexport)
35 # elif defined(BU_TESTS_DLL_IMPORTS)
36 # define BU_TESTS_EXPORT __declspec(dllimport)
37 # else
38 # define BU_TESTS_EXPORT
39 # endif
40 #endif
41 
42 
43 /* Define pass/fail per CMake/CTest testing convention; so any
44  * individual test must return CTEST_PASS/CTEST_FAIL using the same
45  * convention OR invert its value. */
46 const int CTEST_PASS = 0;
47 const int CTEST_FAIL = 1;
48 
49 #ifndef FALSE
50 #define FALSE 0
51 #endif
52 #ifndef TRUE
53 #define TRUE 1
54 #endif
55 
56 typedef enum {
57  HEX = 0x0001,
58  HEX_RAW = 0x0011,
59  BINARY = 0x0100,
60  BINARY_RAW = 0x1100
62 
63 
64 /**
65  * Dump a bitv into a detailed bit format for debugging.
66  */
67 BU_TESTS_EXPORT extern void dump_bitv(const struct bu_bitv *);
68 
69 
70 /**
71  * Get a random number from system entropy (typically used for seeding
72  * the 'random' function).
73  */
74 BU_TESTS_EXPORT extern long int bu_get_urandom_number();
75 
76 
77 /**
78  * Get a random string of hex or binary characters (possibly with a
79  * leading '0x' or '0b').
80  */
81 BU_TESTS_EXPORT extern void random_hex_or_binary_string(struct bu_vls *v, const hex_bin_enum_t typ, const int nbytes);
82 
83 #endif /* LIBBU_TESTS_TEST_INTERNALS_H */
84 
85 
86 /*
87  * Local Variables:
88  * mode: C
89  * tab-width: 8
90  * indent-tabs-mode: t
91  * c-file-style: "stroustrup"
92  * End:
93  * ex: shiftwidth=4 tabstop=8
94  */
95 
BU_TESTS_EXPORT void dump_bitv(const struct bu_bitv *)
Definition: test_funcs.c:60
BU_TESTS_EXPORT long int bu_get_urandom_number()
Definition: test_funcs.c:43
const int CTEST_FAIL
#define __BEGIN_DECLS
Definition: common.h:73
#define BU_TESTS_EXPORT
BU_TESTS_EXPORT void random_hex_or_binary_string(struct bu_vls *v, const hex_bin_enum_t typ, const int nbytes)
Definition: test_funcs.c:151
hex_bin_enum_t
Definition: bitv.h:105
Definition: vls.h:56
const int CTEST_PASS