Skip to content

Commit

Permalink
Extent unit test with handleToggles()
Browse files Browse the repository at this point in the history
Per #1729 (comment)
This pretty much confirms `handleToggles()` isn't the problem.
  • Loading branch information
crankyoldgit committed Jan 17, 2022
1 parent 99f2210 commit 8f48fae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/ir_Hitachi_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2197,4 +2197,16 @@ TEST(TestIRHitachiAc264Class, Issue1729_PowerOntoOff) {
EXPECT_FALSE(off.power);
EXPECT_EQ(stdAc::opmode_t::kHeat, off.mode);
EXPECT_EQ(25, off.degrees);

// Verify that handleToggles() isn't screwing anything up.
IRac common(kGpioUnused);
stdAc::state_t toggle_state;
toggle_state = common.handleToggles(on, &prev);
EXPECT_FALSE(common.cmpStates(on, prev)); // They are the same.
EXPECT_FALSE(common.cmpStates(on, toggle_state)); // They are the same.
toggle_state = common.handleToggles(off, &on);
EXPECT_TRUE(common.cmpStates(off, on)); // They are different.
EXPECT_FALSE(common.cmpStates(off, toggle_state)); // They are the same.
EXPECT_EQ(off.protocol, decode_type_t::HITACHI_AC264);
// That confirms handleToggles() isn't causing any grief.
}

0 comments on commit 8f48fae

Please sign in to comment.