OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
testing.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, Inc.
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 /*
18  * File: testing.h
19  * Author: sstewart
20  *
21  * Created on June 21, 2014, 2:33 PM
22  */
23 
24 #ifndef TESTING_H
25 #define TESTING_H
26 
27 namespace Testing {
28 
29 static unsigned pass = 0;
30 static unsigned fail = 0;
31 static unsigned skip = 0;
32 
33 #define PPASS(msg) \
34  (printf("[%s:%d] %s PASS(%d):\t%s%s\n", \
35  __FILE__, \
36  __LINE__, \
37  ANSI_COLOR_GREEN, \
38  ++pass, \
39  msg, \
40  ANSI_COLOR_RESET))
41 #define PFAIL(msg) \
42  (printf("[%s:%d] %s FAIL(%d):\t%s%s\n", \
43  __FILE__, \
44  __LINE__, \
45  ANSI_COLOR_RED, \
46  ++fail, \
47  msg, \
48  ANSI_COLOR_RESET))
49 #define PSKIP(msg) \
50  (printf("[%s:%d] %s SKIP(%d):\t%s%s\n", \
51  __FILE__, \
52  __LINE__, \
53  ANSI_COLOR_BLUE, \
54  ++skip, \
55  msg, \
56  ANSI_COLOR_RESET))
57 #define PCLEAR \
58  pass = 0; \
59  fail = 0; \
60  skip = 0;
61 
63  printf("pass=%u fail=%u skip=%u total=%u (%.1f%% %.1f%% %.1f%%)\n",
64  pass,
65  fail,
66  skip,
67  (pass + fail),
68  ((double)pass / (pass + fail)) * 100,
69  ((double)fail / (pass + fail)) * 100,
70  ((double)skip / (pass + fail)) * 100);
71 }
72 } // namespace Testing
73 #endif /* TESTING_H */
void printTestSummary()
Definition: testing.h:62
static unsigned skip
Definition: testing.h:31
static unsigned fail
Definition: testing.h:30
static unsigned pass
Definition: testing.h:29