Improved ASSERT macro, and renamed tests/check.hpp to tests/assert.hpp

This commit is contained in:
eidheim 2019-03-23 13:46:31 +01:00
commit e716cd9764
6 changed files with 13 additions and 14 deletions

8
tests/assert.hpp Normal file
View file

@ -0,0 +1,8 @@
#ifndef TESTS_ASSERT_HPP
#define TESTS_ASSERT_HPP
#include <cstdlib>
#define ASSERT(e) ((void)((e) ? ((void)0) : ((void)fprintf(stderr, "Assertion failed: (%s), function %s, file %s, line %u.\n", #e, __func__, __FILE__, __LINE__), abort())))
#endif /* TESTS_ASSERT_HPP */

View file

@ -1,8 +0,0 @@
#ifndef CHECK_HPP
#define CHECK_HPP
#include <cstdlib>
#define ASSERT(cond) if (!(cond)) { std::abort(); }
#endif /* CHECK_HPP */

View file

@ -1,7 +1,6 @@
#include <vector> #include "assert.hpp"
#include "check.hpp"
#include "crypto.hpp" #include "crypto.hpp"
#include <vector>
using namespace std; using namespace std;
using namespace SimpleWeb; using namespace SimpleWeb;

View file

@ -1,6 +1,6 @@
#include "assert.hpp"
#include "client_http.hpp" #include "client_http.hpp"
#include "server_http.hpp" #include "server_http.hpp"
#include "check.hpp"
using namespace std; using namespace std;

View file

@ -1,6 +1,6 @@
#include "assert.hpp"
#include "client_http.hpp" #include "client_http.hpp"
#include "server_http.hpp" #include "server_http.hpp"
#include "check.hpp"
#include <iostream> #include <iostream>
using namespace std; using namespace std;

View file

@ -1,5 +1,5 @@
#include "assert.hpp"
#include "status_code.hpp" #include "status_code.hpp"
#include "check.hpp"
using namespace SimpleWeb; using namespace SimpleWeb;