dc sampler test

This commit is contained in:
Matthew Kennedy 2023-08-09 13:36:48 -07:00
parent 49734dec08
commit 1897917dd7
1 changed files with 16 additions and 1 deletions

View File

@ -14,7 +14,22 @@ int GetESRSupplyR()
return 22000;
}
TEST(Sampler, Basic)
TEST(Sampler, TestDcBehavior)
{
Sampler dut;
AnalogChannelResult data;
data.NernstVoltage = 0.45f;
data.PumpCurrentVoltage = 1.75f;
constexpr float virtualGroundVoltage = 1.65f;
for (size_t i = 0; i < 10; i++)
{
dut.ApplySample(data, virtualGroundVoltage);
}
// not exactly 0 because of filtering
EXPECT_NEAR(0, dut.GetNernstAc(), 1e-3);
EXPECT_FLOAT_EQ(0.45f, dut.GetNernstDc());
EXPECT_NEAR(-0.0295, dut.GetPumpNominalCurrent(), 1e-3);
}