2018-03-04 12:57:15 -08:00
|
|
|
/*
|
2019-09-22 06:56:06 -07:00
|
|
|
* @file unit_test_framework.h
|
2018-03-04 12:57:15 -08:00
|
|
|
*
|
2019-09-22 06:56:06 -07:00
|
|
|
* @date Mar 4, 2018
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2018-03-04 12:57:15 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UNIT_TEST_FRAMEWORK_H_
|
|
|
|
#define UNIT_TEST_FRAMEWORK_H_
|
|
|
|
|
2018-03-04 20:08:32 -08:00
|
|
|
#include "engine.h"
|
2019-01-08 19:10:54 -08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "gmock/gmock.h"
|
2019-12-01 22:52:54 -08:00
|
|
|
using ::testing::Return;
|
2018-03-04 12:57:15 -08:00
|
|
|
|
2019-10-13 06:59:43 -07:00
|
|
|
// This lets us inspect private state from unit tests
|
|
|
|
#define private public
|
|
|
|
|
2020-01-30 22:49:10 -08:00
|
|
|
/**
|
|
|
|
* These are usually used with ASSETR_NEAR(val1, val2, abs_error)
|
|
|
|
*/
|
2019-11-05 21:01:08 -08:00
|
|
|
#define EPS0D 1
|
2019-01-14 15:20:20 -08:00
|
|
|
#define EPS1D 0.1
|
|
|
|
#define EPS2D 0.01
|
|
|
|
#define EPS3D 0.001
|
|
|
|
#define EPS4D 0.0001
|
|
|
|
#define EPS5D 0.00001
|
|
|
|
|
2019-01-14 20:40:13 -08:00
|
|
|
// todo: migrate to googletest, use EXPECT_* and ASSERT_*
|
2018-03-04 19:00:32 -08:00
|
|
|
void assertEqualsM2(const char *msg, float expected, float actual, float EPS);
|
|
|
|
void assertEqualsM(const char *msg, float expected, float actual);
|
|
|
|
void assertEqualsLM(const char *msg, long expected, long actual);
|
|
|
|
void assertEqualsM4(const char *prefix, const char *msg, float expected, float actual);
|
2018-03-04 12:57:15 -08:00
|
|
|
|
|
|
|
#endif /* UNIT_TEST_FRAMEWORK_H_ */
|