Skip to content

Commit

Permalink
🔀️ Merge branch 'yann/feature/rfid/deep-sleep-ft-add-card-card-detect…
Browse files Browse the repository at this point in the history
…ion-test' into develop
  • Loading branch information
ladislas committed Jul 12, 2024
2 parents 6123b30 + 3233ebf commit 569b838
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/functional/tests/deep_sleep_rfid_kit/suite_rfid_kit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,56 @@ suite suite_rfid_kit = [] {
};
};
};

scenario("enabled/disable deepsleep then magic card detected") = [] {
given("rfid is in default configuration") = [] {
auto cardDetected = false;
rfidkit.onTagActivated([&cardDetected](const MagicCard &card) { cardDetected = true; });

when("I wait") = [&] {
cardDetected = false;
rtos::ThisThread::sleep_for(1s);

then("I expect card TO BE detected") = [&cardDetected] { expect(cardDetected); };
};

when("I enable rfid deep sleep") = [&] {
rtos::ThisThread::sleep_for(500ms);
rfidkit.enableDeepSleep();
rtos::ThisThread::sleep_for(500ms);

then("I expect deep sleep TO BE possible") = [] {
auto status = utils::sleep::system_deep_sleep_check();

expect(status.test_check_ok);
};
};

when("I wait") = [&] {
cardDetected = false;
rtos::ThisThread::sleep_for(1s);

then("I expect card TO NOT BE detected") = [&cardDetected] { expect(not cardDetected); };
};

when("I disable rfid deep sleep") = [&] {
rtos::ThisThread::sleep_for(500ms);
rfidkit.disableDeepSleep();
rtos::ThisThread::sleep_for(500ms);

then("I expect deep sleep TO NOT BE possible") = [] {
auto status = utils::sleep::system_deep_sleep_check();

expect(not status.test_check_ok);
};
};

when("I wait") = [&] {
cardDetected = false;
rtos::ThisThread::sleep_for(1s);

then("I expect card TO BE detected") = [&cardDetected] { expect(cardDetected); };
};
};
};
};

0 comments on commit 569b838

Please sign in to comment.