예제 #1
0
파일: unit_test.hpp 프로젝트: asianhawk/oos
 void assert_not_null(const T *a, const std::string &msg, int line, const char *file)
 {
   if (a == 0) {
     // throw exception
     std::stringstream msgstr;
     msgstr << "FAILURE at " << file << ":" << line << ": value " << a << " is null: " << msg;
     throw unit_exception(msgstr.str());
   }
 }
예제 #2
0
파일: unit_test.cpp 프로젝트: zussel/oos
void unit_test::assert_true(bool a, const std::string &msg, int line, const char *file)
{
  ++current_test_func_info->assertion_count;
  if (!a) {
      std::stringstream msgstr;
      msgstr << "FAILURE at " << file << ":" << line << ": value " << a << " is false: " << msg;
      throw unit_exception(msgstr.str());
  }
}
예제 #3
0
파일: unit_test.hpp 프로젝트: asianhawk/oos
 void assert_less(const T &a, const T &b, const std::string &msg, int line, const char *file)
 {
   if (a >= b) {
     // throw exception
     std::stringstream msgstr;
     msgstr << "FAILURE at " << file << ":" << line << ": value " << a << " is greater equal " << b << ": " << msg;
     throw unit_exception(msgstr.str());
   }
 }
예제 #4
0
파일: unit_test.hpp 프로젝트: asianhawk/oos
 void assert_greater(const X &a, const Y &b, const std::string &msg, int line, const char *file)
 {
   if (a <= b) {
     // throw exception
     std::stringstream msgstr;
     msgstr << "FAILURE at " << file << ":" << line << ": value " << a << " is not greater " << b << ": " << msg;
     throw unit_exception(msgstr.str());
   }
 }
예제 #5
0
파일: unit_test.hpp 프로젝트: asianhawk/oos
 void assert_equal(const char *a, const char *b, const std::string &msg, int line, const char *file)
 {
   if (strcmp(a, b) != 0) {
     // throw exception
     std::stringstream msgstr;
     msgstr << "FAILURE at " << file << ":" << line << ": value " << a << " is not equal " << b << ": " << msg;
     throw unit_exception(msgstr.str());
   }
 }
예제 #6
0
파일: unit_test.hpp 프로젝트: asianhawk/oos
 void assert_equal(const X &a, const bool &b, const std::string &msg, int line, const char *file)
 {
   bool cmp = a > 0;
   if (cmp != b) {
     // throw exception
     std::stringstream msgstr;
     msgstr << "FAILURE at " << file << ":" << line << ": value " << a << " is not equal " << b << ": " << msg;
     throw unit_exception(msgstr.str());
   }
 }
예제 #7
0
파일: unit_test.cpp 프로젝트: zussel/oos
void unit_test::error(const std::string &msg, int line, const char *file)
{
  std::stringstream msgstr;
  msgstr << "FAILURE at " << file << ":" << line << ": " << msg;
  throw unit_exception(msgstr.str());
}