This commit is contained in:
rusefi 2019-12-10 01:03:02 -05:00
parent 52c15a7d9b
commit 9f5535721e
1 changed files with 8 additions and 17 deletions

View File

@ -5,9 +5,6 @@
* @author Andrey Belomutskiy, (c) 2012-2019
*/
#ifndef TEST_ION_CPP_
#define TEST_ION_CPP_
#include "gtest/gtest.h"
#include "cdm_ion_sense.h"
@ -16,28 +13,22 @@ TEST(ion, signalCounter) {
EXPECT_EQ(0, state.getValue(0));
state.onNewSignal(2);
state.onNewSignal(2);
state.onNewSignal(2);
state.onNewSignal(/* currentRevolution= */ 2);
state.onNewSignal(/* currentRevolution= */ 2);
state.onNewSignal(/* currentRevolution= */ 2);
// value is still '0' until we signal end of engine cycle
EXPECT_EQ(0, state.getValue(2));
EXPECT_EQ(0, state.getValue(/* currentRevolution= */2));
// this invocation would flush current accumulation
EXPECT_EQ(3, state.getValue(3));
EXPECT_EQ(3, state.getValue(/* currentRevolution= */3));
state.onNewSignal(3);
state.onNewSignal(/* currentRevolution= */3);
// returning previous full cycle value
EXPECT_EQ(3, state.getValue(3));
EXPECT_EQ(1, state.getValue(4));
EXPECT_EQ(0, state.getValue(5));
EXPECT_EQ(1, state.getValue(/* currentRevolution= */4));
EXPECT_EQ(0, state.getValue(/* currentRevolution= */5));
}
#endif /* TEST_ION_CPP_ */