UniMRCP  1.3.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
apt_test_suite.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008-2014 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  * $Id: apt_test_suite.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $
17  */
18 
19 #ifndef APT_TEST_SUITE_H
20 #define APT_TEST_SUITE_H
21 
22 /**
23  * @file apt_test_suite.h
24  * @brief Test Suite and Framework Definitions
25  */
26 
27 #include "apt_string.h"
28 
30 
31 
32 /** Opaque test suite declaration */
34 
35 /** Prototype of test function */
36 typedef apt_bool_t (*apt_test_f)(apt_test_suite_t *suite, int argc, const char * const *argv);
37 
38 /** Test suite as a base for all kind of tests */
40  /** Memory pool to allocate memory from */
41  apr_pool_t *pool;
42  /** Unique name of the test suite */
44  /** External object associated with the test suite */
45  void *obj;
46  /** Test function to execute */
48 };
49 
50 /**
51  * Create test suite.
52  * @param pool the pool to allocate memory from
53  * @param name the unique name of the test suite
54  * @param obj the external object associated with the test suite
55  * @param tester the test function to execute
56  */
57 APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name,
58  void *obj, apt_test_f tester);
59 
60 
61 
62 
63 
64 /** Opaque test framework declaration */
66 
67 /**
68  * Create test framework.
69  */
70 APT_DECLARE(apt_test_framework_t*) apt_test_framework_create(void);
71 
72 /**
73  * Destroy test framework.
74  * @param framework the test framework to destroy
75  */
76 APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework);
77 
78 /**
79  * Add test suite to framework.
80  * @param framework the test framework to add test suite to
81  * @param suite the test suite to add
82  */
83 APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite);
84 
85 /**
86  * Run test suites.
87  * @param framework the test framework
88  * @param argc the number of arguments
89  * @param argv the array of arguments
90  */
91 APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv);
92 
93 /**
94  * Retrieve the memory pool.
95  * @param framework the test framework to retrieve memory pool from
96  */
97 APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(const apt_test_framework_t *framework);
98 
100 
101 #endif /* APT_TEST_SUITE_H */