rusefi/unit_tests/unit_test_framework.h

33 lines
857 B
C
Raw Normal View History

2018-03-04 12:57:15 -08:00
/*
* @file unit_test_framework.h
2018-03-04 12:57:15 -08: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
#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_ */