-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathtest.h
27 lines (21 loc) · 774 Bytes
/
test.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Observable Library
// Copyright (C) 2016 David Capello
#pragma once
#include <cstdlib>
#include <iostream>
template<typename T, typename U>
inline void expect_eq(const T& expected, const U& value,
const char* file, const int line) {
if (expected != value) {
std::cout << file << ":" << line << ": failed\n"
<< " Expected: " << expected << "\n"
<< " Actual: " << value << std::endl;
std::abort();
}
}
#define EXPECT_EQ(expected, value) \
expect_eq(expected, value, __FILE__, __LINE__);
#define EXPECT_TRUE(value) \
expect_eq(true, value, __FILE__, __LINE__);
#define EXPECT_FALSE(value) \
expect_eq(false, value, __FILE__, __LINE__);