Inlining + Reorganization + Roofline
This commit is contained in:
committed by
Linus Baumberger
parent
43f11a661b
commit
b86c856e08
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include "vector2d.hpp"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// default tolerance value
|
||||
constexpr double tolerance = 1e-9;
|
||||
|
||||
// Compare two Vector2d component-wise, with tolerance, and assert if difference between expected and obtained value is below tolerance
|
||||
inline ::testing::AssertionResult Vec2Near(const Vector2d &a, const Vector2d &b, double tol = tolerance) {
|
||||
if (std::fabs(a.x - b.x) <= tol && std::fabs(a.y - b.y) <= tol) {
|
||||
return ::testing::AssertionSuccess();
|
||||
}
|
||||
return ::testing::AssertionFailure() << "expected (" << b.x << ", " << b.y << "), got (" << a.x << ", " << a.y << "), diff (" << (a.x - b.x) << ", " << (a.y - b.y) << ")" << ", exceeds tolerance : " << tol;
|
||||
}
|
||||
|
||||
#define EXPECT_VEC2_NEAR(actual, expected) EXPECT_TRUE(Vec2Near((actual), (expected)))
|
||||
|
||||
#define EXPECT_VEC2_NEAR_TOL(actual, expected, tol) EXPECT_TRUE(Vec2Near((actual), (expected), (tol)))
|
||||
Reference in New Issue
Block a user