Prusa-Firmware/Tests/Timer_test.cpp

39 lines
705 B
C++
Raw Normal View History

2018-06-11 20:50:52 +00:00
/**
* @file
* @author Marek Bel
*/
#include "catch.hpp"
#include "../Firmware/Timer.h"
2018-06-11 21:41:36 +00:00
#include "../Firmware/TimerRemaining.h"
2018-06-11 20:50:52 +00:00
unsigned long millis()
{
return 1;
}
TEST_CASE( "LongTimer tested.", "[timer]" )
{
LongTimer timer;
REQUIRE( timer.running() == false);
timer.start();
REQUIRE( timer.running() == true);
timer.stop();
REQUIRE( timer.running() == false);
timer.start();
REQUIRE( timer.expired(0) == true );
REQUIRE( timer.expired(0) == false );
REQUIRE( timer.running() == false);
timer.start();
REQUIRE( timer.expired(1) == false );
REQUIRE( timer.running() == true);
2018-06-11 21:41:36 +00:00
TimerRemaining otherTimer;
otherTimer.start(100);
2018-06-11 20:50:52 +00:00
}