testing.h
Go to the documentation of this file.
00001 #include <math.h>
00002 #include <stdlib.h>
00003 
00004 // this is mimicing gtest expressions
00005 
00006 #define EXPECT_TRUE(args) {                                             \
00007     if (!(args)) { fprintf(stderr, "test failed (EXPECT_TRUE) in %s, line %d\n", __FILE__, __LINE__); \
00008       exit(1);                                                         \
00009     } }
00010 
00011 #define EXPECT_FALSE(args) {                                             \
00012     if (args) { fprintf(stderr, "test failed (EXPECT_FALSE) in %s, line %d\n", __FILE__, __LINE__); \
00013       exit(1);                                                         \
00014     } }
00015 
00016 #define EXPECT_EQ(a,b) {                                                \
00017     if (!(a == b)) { std::cerr << "test failed: " <<a<<"!="<<b<< " in " \
00018                       << __FILE__ << ", line " <<__LINE__ << std::endl; \
00019       exit(1);                                                          \
00020     } }
00021 
00022 #define EXPECT_FLOAT_EQ(a,b) {                                          \
00023     if (!(fabs(a-b) <= 1e-5)) { fprintf(stderr, "test failed: %f != %f in %s, line %d\n", a, b, __FILE__, __LINE__); \
00024       exit(1);                                                         \
00025     } }
00026 
00027 #define EXPECT_NEAR(a,b,prec) {                                         \
00028     if (!(fabs(a-b) <= prec)) { fprintf(stderr, "test failed: |%f - %f| > %f in %s, line %d\n", a, b, prec, __FILE__, __LINE__); \
00029       exit(1);                                                         \
00030     } }
00031 


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Thu Jun 6 2019 17:31:45