1 /* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
5 * Copyright (C) 2011 Data Differential, http://datadifferential.com/
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following disclaimer
16 * in the documentation and/or other materials provided with the
19 * * The names of its contributors may not be used to endorse or
20 * promote products derived from this software without specific prior
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 Framework is the structure which is passed to the test implementation to be filled.
42 This must be implemented in order for the test framework to load the tests. We call
43 get_world() in order to fill this structure.
47 collection_st
*collections
;
49 /* These methods are called outside of any collection call. */
50 test_callback_create_fn
*_create
;
51 test_callback_fn
*_destroy
;
53 void* create(test_return_t
& arg
);
55 /* This is called a the beginning of any collection run. */
56 test_callback_fn
*collection_startup
;
58 test_return_t
startup(void*);
60 /* This is called a the end of any collection run. */
61 test_callback_fn
*collection_shutdown
;
63 test_return_t
shutdown(void* arg
)
65 if (collection_shutdown
)
67 return collection_shutdown(arg
);
74 These are run before/after the test. If implemented. Their execution is not controlled
78 /* This is called a the beginning of any run. */
79 test_callback_fn
*_startup
;
81 test_return_t
startup(void*);
84 This called on a test if the test requires a flush call (the bool is
87 test_callback_fn
*_flush
;
90 Run before and after the runnner is executed.
92 test_callback_fn
*pre_run
;
93 test_callback_fn
*post_run
;
102 test_return_t
flush(void* arg
, test_st
* run
);
104 void set_pre(test_callback_fn
*arg
)
109 void set_post(test_callback_fn
*arg
)
114 test_return_t
pre(void *arg
)
124 test_return_t
post(void *arg
)
128 return post_run(arg
);
137 If an error occurs during the test, this is called.
139 test_callback_error_fn
*_on_error
;
141 test_return_t
on_error(const enum test_return_t
, void *);
144 Runner represents the callers for the tests. If not implemented we will use
145 a set of default implementations.
151 virtual ~Framework();
153 Framework(const Framework
&);
156 Framework
& operator=(const Framework
&);