mirror of https://github.com/rusefi/rusefi.git
Compare commits
5 Commits
75f38f6913
...
93edf72814
Author | SHA1 | Date |
---|---|---|
rusEFI LLC | 93edf72814 | |
kifir | 998d1caae1 | |
kifir | 80cf6d1943 | |
kifir | a734efdf87 | |
kifir | 964e595af2 |
|
@ -223,10 +223,13 @@ public:
|
|||
|
||||
#if EFI_UNIT_TEST
|
||||
bool needTdcCallback = true;
|
||||
int bailedOnDwell = 0;
|
||||
private:
|
||||
int bailedOnDwellCount = 0;
|
||||
public:
|
||||
int getBailedOnDwellCount() const { return bailedOnDwellCount; }
|
||||
void incrementBailedOnDwellCount() { bailedOnDwellCount++; }
|
||||
#endif /* EFI_UNIT_TEST */
|
||||
|
||||
|
||||
int getGlobalConfigurationVersion(void) const;
|
||||
|
||||
|
||||
|
|
|
@ -55,10 +55,6 @@ public:
|
|||
scheduling_s dwellStartTimer;
|
||||
AngleBasedEvent sparkEvent;
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
bool bailedOnDwell = false;
|
||||
#endif
|
||||
|
||||
scheduling_s trailingSparkCharge;
|
||||
scheduling_s trailingSparkFire;
|
||||
|
||||
|
|
|
@ -334,7 +334,7 @@ void turnSparkPinHighStartCharging(IgnitionEvent *event) {
|
|||
}
|
||||
|
||||
#if EFI_UNIT_TEST
|
||||
event->bailedOnDwell = skippedDwellDueToTriggerNoised;
|
||||
engine->incrementBailedOnDwellCount();
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#define PORT_SIZE 16
|
||||
|
||||
// 168 ticks in microsecond in case of 168MHz 407
|
||||
// todo: stm32 ticks are based on 4MHz timer I wonder if these CORE_CLOCK-based clocks are broken here?!
|
||||
#define US_TO_NT_MULTIPLIER (CORE_CLOCK / 1000000)
|
||||
|
||||
// Scheduler queue GPT device
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// This is the radical departure from STM32
|
||||
#define PORT_SIZE 18
|
||||
|
||||
// 168 ticks in microsecond in case of 168MHz 407
|
||||
// todo: stm32 ticks are based on 4MHz timer I wonder if these CORE_CLOCK-based clocks are broken here?!
|
||||
#define US_TO_NT_MULTIPLIER (CORE_CLOCK / 1000000)
|
||||
|
||||
// Scheduler queue GPT device
|
||||
|
|
|
@ -3,3 +3,4 @@ build*/
|
|||
gcov_working_area
|
||||
triggers
|
||||
unittest*.logicdata
|
||||
/.idea/
|
||||
|
|
|
@ -3,8 +3,8 @@ See https://github.com/rusefi/rusefi/wiki/Dev-Quality-Control
|
|||
TL, DR: just follow [tests](tests) folder as examples. gcc/makefile/gtest
|
||||
|
||||
1. Run 'make' to build desktop binary.
|
||||
1. Execute rusefi_test binary on your PC/Mac, it's expected to say SUCCESS and not fail :) Googletest will also print results summary.
|
||||
1. To run only one test uncomment and modify [main.cpp](https://github.com/rusefi/rusefi/blob/master/unit_tests/main.cpp) line ``::testing::GTEST_FLAG(filter)``
|
||||
2. Execute rusefi_test binary on your PC/Mac, it's expected to say SUCCESS and not fail :) Googletest will also print results summary.
|
||||
3. To run only one test use command line like ```build/rusefi_test --gtest_filter=*TEST_NAME*``` ~~uncomment and modify [main.cpp](https://github.com/rusefi/rusefi/blob/master/unit_tests/main.cpp) line ``::testing::GTEST_FLAG(filter)``~~
|
||||
|
||||
In this folder we have rusEFI unit tests using https://github.com/google/googletest
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ private:
|
|||
FILE *fp = nullptr;
|
||||
char buffer[255];
|
||||
|
||||
bool currentState[2] = {0, 0};
|
||||
bool currentState[TRIGGER_INPUT_PIN_COUNT] = {0, 0};
|
||||
bool currentVvtState[CAM_INPUTS_COUNT] = {0, 0};
|
||||
|
||||
int m_lineIndex = -1;
|
||||
|
|
|
@ -65,4 +65,6 @@ TEST(OddFireRunningMode, hd) {
|
|||
eth.assertEvent5("spark down2#3", 3, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(-180 + cylinderTwo - timing));
|
||||
eth.assertEvent5("fuel down2#6", 6, (void*)turnInjectionPinLow, eth.angleToTimeUs(540 + PORT_INJECTION_OFFSET + cylinderTwo));
|
||||
eth.assertEvent5("spark down2#7", 7, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(180 + cylinderOne - timing));
|
||||
|
||||
ASSERT_EQ(2, engine->getBailedOnDwellCount()) << "Please check if our dwell algorithm have really got better.";
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "pch.h"
|
||||
#include "logicdata_csv_reader.h"
|
||||
|
||||
static void testNoOverdwell(const char* file, bool instantRpm) {
|
||||
static void testNoOverdwell(const char* file, bool instantRpm, const int expectedBailedOnDwellCount) {
|
||||
CsvReader reader(1, /* vvtCount */ 0);
|
||||
|
||||
reader.open(file);
|
||||
|
@ -49,29 +49,30 @@ static void testNoOverdwell(const char* file, bool instantRpm) {
|
|||
reader.processLine(ð);
|
||||
}
|
||||
|
||||
// nothing to check here, just that no coils got stuck on
|
||||
ASSERT_EQ(expectedBailedOnDwellCount, engine->getBailedOnDwellCount())
|
||||
<< "Please check if our dwell algorithm have really got better.";
|
||||
}
|
||||
|
||||
TEST(RealNoisyTrigger, AvoidOverdwell1NoInstant) {
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-1.csv", false);
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-1.csv", false, 25);
|
||||
}
|
||||
|
||||
TEST(RealNoisyTrigger, AvoidOverdwell1WithInstant) {
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-1.csv", true);
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-1.csv", true, 23);
|
||||
}
|
||||
|
||||
TEST(RealNoisyTrigger, AvoidOverdwell2NoInstant) {
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-2.csv", false);
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-2.csv", false, 89);
|
||||
}
|
||||
|
||||
TEST(RealNoisyTrigger, AvoidOverdwell2WithInstant) {
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-2.csv", true);
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-2.csv", true, 85);
|
||||
}
|
||||
|
||||
TEST(RealNoisyTrigger, AvoidOverdwell3NoInstant) {
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-3.csv", false);
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-3.csv", false, 25);
|
||||
}
|
||||
|
||||
TEST(RealNoisyTrigger, AvoidOverdwell3WithInstant) {
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-3.csv", true);
|
||||
testNoOverdwell("tests/trigger/resources/noisy-trigger-3.csv", true, 22);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue