UniMRCP  1.7.0
apt_test_suite.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2015 Arsen Chaloyan
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef APT_TEST_SUITE_H
18 #define APT_TEST_SUITE_H
19 
20 /**
21  * @file apt_test_suite.h
22  * @brief Test Suite and Framework Definitions
23  */
24 
25 #include "apt_string.h"
26 
28 
29 
30 /** Opaque test suite declaration */
32 
33 /** Prototype of test function */
34 typedef apt_bool_t (*apt_test_f)(apt_test_suite_t *suite, int argc, const char * const *argv);
35 
36 /** Test suite as a base for all kind of tests */
38  /** Memory pool to allocate memory from */
39  apr_pool_t *pool;
40  /** Unique name of the test suite */
42  /** External object associated with the test suite */
43  void *obj;
44  /** Test function to execute */
46 };
47 
48 /**
49  * Create test suite.
50  * @param pool the pool to allocate memory from
51  * @param name the unique name of the test suite
52  * @param obj the external object associated with the test suite
53  * @param tester the test function to execute
54  */
55 APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name,
56  void *obj, apt_test_f tester);
57 
58 
59 
60 
61 
62 /** Opaque test framework declaration */
64 
65 /**
66  * Create test framework.
67  */
69 
70 /**
71  * Destroy test framework.
72  * @param framework the test framework to destroy
73  */
75 
76 /**
77  * Add test suite to framework.
78  * @param framework the test framework to add test suite to
79  * @param suite the test suite to add
80  */
82 
83 /**
84  * Run test suites.
85  * @param framework the test framework
86  * @param argc the number of arguments
87  * @param argv the array of arguments
88  */
89 APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv);
90 
91 /**
92  * Retrieve the memory pool.
93  * @param framework the test framework to retrieve memory pool from
94  */
95 APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(const apt_test_framework_t *framework);
96 
98 
99 #endif /* APT_TEST_SUITE_H */
apt_bool_t apt_test_framework_run(apt_test_framework_t *framework, int argc, const char *const *argv)
struct apt_test_framework_t apt_test_framework_t
Definition: apt_test_suite.h:63
apt_bool_t(* apt_test_f)(apt_test_suite_t *suite, int argc, const char *const *argv)
Definition: apt_test_suite.h:34
apr_pool_t * apt_test_framework_pool_get(const apt_test_framework_t *framework)
#define APT_END_EXTERN_C
Definition: apt.h:38
int apt_bool_t
Definition: apt.h:57
apr_pool_t * pool
Definition: apt_test_suite.h:39
apt_str_t name
Definition: apt_test_suite.h:41
apt_bool_t apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite)
#define APT_BEGIN_EXTERN_C
Definition: apt.h:36
#define APT_DECLARE(type)
Definition: apt.h:53
apt_test_suite_t * apt_test_suite_create(apr_pool_t *pool, const char *name, void *obj, apt_test_f tester)
apt_test_f tester
Definition: apt_test_suite.h:45
apt_test_framework_t * apt_test_framework_create(void)
void * obj
Definition: apt_test_suite.h:43
Definition: apt_string.h:36
void apt_test_framework_destroy(apt_test_framework_t *framework)
Definition: apt_test_suite.h:37
String Representation.