/usr/src/redhat/BUILD/httpd-2.2.3/srclib/apr/test/abts.h

00001 /* Copyright 2000-2004 Ryan Bloom
00002  *
00003  * Licensed under the Apache License, Version 2.0 (the "License");
00004  * you may not use this file except in compliance with the License.
00005  * You may obtain a copy of the License at
00006  *
00007  *     http://www.apache.org/licenses/LICENSE-2.0
00008  *
00009  * Unless required by applicable law or agreed to in writing, software
00010  * distributed under the License is distributed on an "AS IS" BASIS,
00011  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00012  * See the License for the specific language governing permissions and
00013  * limitations under the License.
00014  */
00015 
00016 #ifdef __cplusplus
00017 extern "C" {
00018 #endif
00019 
00020 #include <stdarg.h>
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <string.h>
00024 
00025 #ifndef ABTS_H
00026 #define ABTS_H
00027 
00028 #ifndef FALSE
00029 #define FALSE 0
00030 #endif
00031 #ifndef TRUE
00032 #define TRUE  1
00033 #endif
00034 
00035 struct sub_suite {
00036     const char *name;
00037     int num_test;
00038     int failed;
00039     int not_run;
00040     int not_impl;
00041     struct sub_suite *next;
00042 };
00043 typedef struct sub_suite sub_suite;
00044 
00045 struct abts_suite {
00046     sub_suite *head;
00047     sub_suite *tail;
00048 };
00049 typedef struct abts_suite abts_suite;
00050 
00051 struct abts_case {
00052     int failed;
00053     sub_suite *suite;
00054 };
00055 typedef struct abts_case abts_case;
00056 
00057 typedef void (*test_func)(abts_case *tc, void *data);
00058 
00059 #define ADD_SUITE(suite) abts_add_suite(suite, __FILE__);
00060 
00061 abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name);
00062 void abts_run_test(abts_suite *ts, test_func f, void *value);
00063 void abts_log_message(const char *fmt, ...);
00064 
00065 void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno);
00066 void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno);
00067 void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno);
00068 void abts_str_nequal(abts_case *tc, const char *expected, const char *actual,
00069                        size_t n, int lineno);
00070 void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno);
00071 void abts_ptr_equal(abts_case *tc, const void *expected, const void *actual, int lineno);
00072 void abts_true(abts_case *tc, int condition, int lineno);
00073 void abts_fail(abts_case *tc, const char *message, int lineno);
00074 void abts_not_impl(abts_case *tc, const char *message, int lineno);
00075 void abts_assert(abts_case *tc, const char *message, int condition, int lineno);
00076 
00077 /* Convenience macros. Ryan hates these! */
00078 #define ABTS_INT_EQUAL(a, b, c)     abts_int_equal(a, b, c, __LINE__)
00079 #define ABTS_INT_NEQUAL(a, b, c)    abts_int_nequal(a, b, c, __LINE__)
00080 #define ABTS_STR_EQUAL(a, b, c)     abts_str_equal(a, b, c, __LINE__)
00081 #define ABTS_STR_NEQUAL(a, b, c, d) abts_str_nequal(a, b, c, d, __LINE__)
00082 #define ABTS_PTR_NOTNULL(a, b)      abts_ptr_notnull(a, b, __LINE__)
00083 #define ABTS_PTR_EQUAL(a, b, c)     abts_ptr_equal(a, b, c, __LINE__)
00084 #define ABTS_TRUE(a, b)             abts_true(a, b, __LINE__);
00085 #define ABTS_FAIL(a, b)             abts_fail(a, b, __LINE__);
00086 #define ABTS_NOT_IMPL(a, b)         abts_not_impl(a, b, __LINE__);
00087 #define ABTS_ASSERT(a, b, c)        abts_assert(a, b, c, __LINE__);
00088 
00089 abts_suite *run_tests(abts_suite *suite);
00090 abts_suite *run_tests1(abts_suite *suite);
00091 
00092 
00093 #endif
00094 
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098 

Apacheに対してSun Jul 19 22:05:24 2009に生成されました。  doxygen 1.4.7