forked from rusefi/rusefi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unit_test_framework.cpp
41 lines (33 loc) · 993 Bytes
/
unit_test_framework.cpp
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* @file unit_test_framework.cpp
*
* Created on: Mar 4, 2018
* @author Andrey Belomutskiy, (c) 2012-2020
*/
#include "pch.h"
#include <stdlib.h>
/**
* ASSERT_xxx macro could only be used from inside 'void' methods - for cases where non-void methods are asserting, these
* wrapper functions are still useful.
*/
void assertEqualsM2(const char *msg, float expected, float actual, float eps) {
ASSERT_NEAR(expected, actual, eps) << msg;
}
void assertEqualsM4(const char *prefix, const char *msg, float expected, float actual) {
ASSERT_NEAR(expected, actual, 0.0001f) << prefix << msg;
}
void assertEqualsLM(const char *msg, long expected, long actual) {
ASSERT_EQ(expected, actual) << msg;
}
void assertEqualsM(const char *msg, float expected, float actual) {
assertEqualsM2(msg, expected, actual, 0.0001);
}
void chDbgAssert(int c, char *msg, void *arg) {
if (!c) {
printf("assert failed: %s\r\n", msg);
exit(-1);
}
}
uint32_t getTimeNowLowerNt(void) {
return 0;
}