custom-board-bundle-sample-.../unit_tests/tests/trigger/test_real_k20.cpp

36 lines
1022 B
C++
Raw Normal View History

2022-09-24 12:37:51 -07:00
#include "pch.h"
#include "logicdata_csv_reader.h"
2022-09-24 21:26:42 -07:00
static int getExhaustIndex() {
return getTriggerCentral()->vvtState[/*bankIndex*/0][/*camIndex*/1].currentCycle.current_index;
}
2022-09-24 12:37:51 -07:00
TEST(realk20, cranking) {
CsvReader reader(/* triggerCount */ 1, /* vvtCount */ 2);
2022-09-24 20:18:57 -07:00
reader.open("tests/trigger/resources/civic-K20-cranking.csv", NORMAL_ORDER, REVERSE_ORDER);
2022-09-24 21:26:42 -07:00
reader.twoBanksSingleCamMode = false;
2022-09-24 12:37:51 -07:00
2022-09-24 20:45:09 -07:00
EngineTestHelper eth (PROTEUS_HONDA_K);
2022-09-24 12:37:51 -07:00
2022-09-24 21:26:42 -07:00
while (reader.haveMore() && reader.lineIndex() < 101) {
2022-09-24 20:18:57 -07:00
reader.processLine(&eth);
2022-09-24 21:26:42 -07:00
ASSERT_EQ(getExhaustIndex(), 0) << "Skipping until first exhaust event " << reader.lineIndex();
2022-09-24 12:37:51 -07:00
}
2022-09-24 21:26:42 -07:00
reader.haveMore();
reader.processLine(&eth);
ASSERT_EQ(getExhaustIndex(), 1) << "First exhaust event " << reader.lineIndex();
2022-09-24 20:18:57 -07:00
2022-09-24 12:37:51 -07:00
2022-09-24 21:26:42 -07:00
while (reader.haveMore()) {
reader.processLine(&eth);
ASSERT_TRUE(getExhaustIndex() != 0 ) << "At line " << reader.lineIndex();
}
2022-09-24 12:37:51 -07:00
2022-09-24 21:26:42 -07:00
ASSERT_EQ(173, getExhaustIndex()); // huh? not synching?
2022-09-24 12:37:51 -07:00
2022-09-24 21:26:42 -07:00
ASSERT_EQ(1182, round(Sensor::getOrZero(SensorType::Rpm)));
}