osb/source/test/periodic_test.cpp

31 lines
712 B
C++
Raw Normal View History

2023-06-20 04:33:09 +00:00
#include "StarPeriodic.hpp"
#include "gtest/gtest.h"
using namespace Star;
TEST(PeriodicTest, All) {
Periodic periodic(2);
EXPECT_TRUE(periodic.ready());
EXPECT_TRUE(periodic.tick());
EXPECT_FALSE(periodic.ready());
EXPECT_FALSE(periodic.tick());
EXPECT_TRUE(periodic.ready());
EXPECT_TRUE(periodic.tick());
periodic = Periodic(0);
EXPECT_FALSE(periodic.tick());
EXPECT_FALSE(periodic.tick());
periodic = Periodic(3);
EXPECT_TRUE(periodic.ready());
EXPECT_TRUE(periodic.tick());
EXPECT_FALSE(periodic.ready());
EXPECT_FALSE(periodic.tick());
EXPECT_FALSE(periodic.tick());
EXPECT_TRUE(periodic.ready());
EXPECT_TRUE(periodic.tick());
EXPECT_FALSE(periodic.ready());
}