| 68 | } // namespace |
| 69 | |
| 70 | TEST(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 | |
| 85 | TEST(LuaSisoTransform, ResetClearsStateViaConstructNewAndSwap) { |
| 86 | auto engine = makeLuauEngine(); |
nothing calls this directly
no test coverage detected