Add an internal ASSERT macro

This macro has some advantages over the standard library one:
 - It prints the place where the macro was triggered
 - It "references" the condition even in Release to avoid warnings
 - In release, if possible, it gives compiler hints

It is basically is stripped down version of the ASSERT macros I wrote
for the Daemon engine in src/common/Assert.h

This commit also removes the stray "backend" namespaces for common/
code.
This commit is contained in:
Corentin Wallez
2017-07-10 13:46:05 -04:00
committed by Corentin Wallez
parent bd0594bab8
commit fd589f3919
37 changed files with 612 additions and 485 deletions

View File

@@ -16,11 +16,11 @@
#include "common/SerialQueue.h"
using SerialQueue = backend::SerialQueue<int>;
using TestSerialQueue = SerialQueue<int>;
// A number of basic tests for SerialQueue that are difficult to split from one another
TEST(SerialQueue, BasicTest) {
SerialQueue queue;
TestSerialQueue queue;
// Queue starts empty
ASSERT_TRUE(queue.Empty());
@@ -57,7 +57,7 @@ TEST(SerialQueue, BasicTest) {
// Test enqueuing vectors works
TEST(SerialQueue, EnqueueVectors) {
SerialQueue queue;
TestSerialQueue queue;
std::vector<int> vector1 = {1, 2, 3, 4};
std::vector<int> vector2 = {5, 6, 7, 8};
@@ -78,7 +78,7 @@ TEST(SerialQueue, EnqueueVectors) {
// Test IterateUpTo
TEST(SerialQueue, IterateUpTo) {
SerialQueue queue;
TestSerialQueue queue;
std::vector<int> vector1 = {1, 2, 3, 4};
std::vector<int> vector2 = {5, 6, 7, 8};
@@ -99,7 +99,7 @@ TEST(SerialQueue, IterateUpTo) {
// Test ClearUpTo
TEST(SerialQueue, ClearUpTo) {
SerialQueue queue;
TestSerialQueue queue;
std::vector<int> vector1 = {1, 2, 3, 4};
std::vector<int> vector2 = {5, 6, 7, 8};
@@ -122,7 +122,7 @@ TEST(SerialQueue, ClearUpTo) {
// Test FirstSerial
TEST(SerialQueue, FirstSerial) {
SerialQueue queue;
TestSerialQueue queue;
std::vector<int> vector1 = {1, 2, 3, 4};
std::vector<int> vector2 = {5, 6, 7, 8};