MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / TEST

Function TEST

pj_scripting/tests/lua_siso_transform_test.cpp:70–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68} // namespace
69
70TEST(LuaSisoTransform, FirstSampleSuppressedThenDifferentiates) {
71 auto engine = makeLuauEngine();
72 LuaSisoTransform xf(engine, loadDerivative(engine), "{}");
73
74 EXPECT_FALSE(xf.calculateNextPoint(Sample::scalar(0, PJ::VarValue{0.0})).has_value());
75 auto a = xf.calculateNextPoint(Sample::scalar(1'000'000'000LL, PJ::VarValue{2.0})); // +1s, v=2
76 ASSERT_TRUE(a.has_value());
77 EXPECT_DOUBLE_EQ(dbl(*a), 2.0);
78 auto b = xf.calculateNextPoint(Sample::scalar(2'000'000'000LL, PJ::VarValue{6.0})); // +1s, v=6
79 ASSERT_TRUE(b.has_value());
80 EXPECT_DOUBLE_EQ(dbl(*b), 4.0);
81 // The output timestamp is the absolute input spine.
82 EXPECT_EQ(b->raw_ts_ns, 2'000'000'000LL);
83}
84
85TEST(LuaSisoTransform, ResetClearsStateViaConstructNewAndSwap) {
86 auto engine = makeLuauEngine();

Callers

nothing calls this directly

Calls 12

makeLuauEngineFunction · 0.85
loadDerivativeFunction · 0.85
dblFunction · 0.85
calculateNextPointMethod · 0.45
resetMethod · 0.45
idMethod · 0.45
saveParamsMethod · 0.45
outputKindsMethod · 0.45
sizeMethod · 0.45
inspectModuleMethod · 0.45
failedMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected