Skip to content

Commit dd0ccf5

Browse files
committed
Initial Scheduler tests
1 parent 30cfea3 commit dd0ccf5

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

extras/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ set(TEST_SRCS
3232
src/test_callback.cpp
3333
src/test_CloudColor.cpp
3434
src/test_CloudLocation.cpp
35+
src/test_CloudScheduler.cpp
3536
src/test_decode.cpp
3637
src/test_encode.cpp
3738
src/test_publishEvery.cpp
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
Copyright (c) 2019 Arduino. All rights reserved.
3+
*/
4+
5+
#ifndef TEST_ARDUINO_CONNECTION_HANDLER_H_
6+
#define TEST_ARDUINO_CONNECTION_HANDLER_H_
7+
8+
/******************************************************************************
9+
TYPEDEF
10+
******************************************************************************/
11+
12+
typedef void ConnectionHandler;
13+
14+
#endif /* TEST_ARDUINO_CONNECTION_HANDLER_H_ */
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
Copyright (c) 2021 Arduino. All rights reserved.
3+
*/
4+
5+
/**************************************************************************************
6+
INCLUDE
7+
**************************************************************************************/
8+
9+
#include <catch.hpp>
10+
11+
#include <property/types/CloudScheduler.h>
12+
13+
unsigned long time_now = 1;
14+
15+
/**************************************************************************************
16+
* TimeService Fake CTOR/DTOR
17+
**************************************************************************************/
18+
19+
TimeService::TimeService() {}
20+
21+
/**************************************************************************************
22+
* TimeService Fake Methods
23+
**************************************************************************************/
24+
25+
unsigned long TimeService::getTime() {return time_now;}
26+
27+
/**************************************************************************************
28+
TEST CODE
29+
**************************************************************************************/
30+
31+
SCENARIO("Tesing cloud type 'Scheduler' Ctor", "[Scheduler::Scheduler]")
32+
{
33+
WHEN("A Scheduler(0,0,0,0,0) is being instantiated")
34+
{
35+
Scheduler schedule(0,0,0,0,0);
36+
THEN("The member variable 'start' should be 0") {
37+
REQUIRE(schedule.start == 0);
38+
}
39+
THEN("The member variable 'end' should be 0") {
40+
REQUIRE(schedule.end == 0);
41+
}
42+
THEN("The member variable 'duration' should be 0") {
43+
REQUIRE(schedule.duration == 0);
44+
}
45+
THEN("The member variable 'type' should be 0") {
46+
REQUIRE(schedule.type == 0);
47+
}
48+
THEN("The member variable 'mask' should be 0") {
49+
REQUIRE(schedule.mask == 0);
50+
}
51+
}
52+
}
53+

0 commit comments

Comments
 (0)