16
16
TEST CODE
17
17
**************************************************************************************/
18
18
19
- /* ***********************************************************************************/
20
- SCENARIO (" Arduino Cloud Properties " , " [ArduinoCloudThing::CloudColor]" ) {
21
- WHEN (" Set invalid color HSB" ) {
22
- GIVEN (" CloudProtocol::V2" ) {
23
-
24
-
25
- CloudColor color_test = CloudColor (0.0 , 0.0 , 0.0 );
26
-
27
- Color value_color_test = color_test.getValue ();
28
- REQUIRE (value_color_test.setColorHSB (500.0 , 20.0 , 30.0 ) == false );
29
-
30
- }
19
+ SCENARIO (" Arduino Cloud Properties " , " [ArduinoCloudThing::CloudColor]" )
20
+ {
21
+ WHEN (" Set invalid color HSB" )
22
+ {
23
+ CloudColor color_test = CloudColor (0.0 , 0.0 , 0.0 );
24
+
25
+ Color value_color_test = color_test.getValue ();
26
+ REQUIRE (value_color_test.setColorHSB (500.0 , 20.0 , 30.0 ) == false );
31
27
}
32
28
33
- WHEN (" Set and Get different RGB colors" ) {
34
- GIVEN (" CloudProtocol::V2" ) {
29
+ WHEN (" Set and Get different RGB colors" )
30
+ {
31
+ uint8_t r, g, b;
35
32
36
- uint8_t r, g, b ;
33
+ CloudColor color_test = CloudColor ( 0.0 , 0.0 , 0.0 ) ;
37
34
38
- CloudColor color_test = CloudColor ( 0.0 , 0.0 , 0.0 );
35
+ Color value_color_test = color_test. getValue ( );
39
36
40
- Color value_color_test = color_test.getValue ();
37
+ value_color_test.setColorRGB (128 , 64 , 64 );
38
+ value_color_test.getRGB (r, g, b);
41
39
42
- value_color_test.setColorRGB (128 , 64 , 64 );
43
- value_color_test.getRGB (r, g, b);
40
+ REQUIRE (r == 128 );
41
+ REQUIRE (g == 64 );
42
+ REQUIRE (b == 64 );
44
43
45
- REQUIRE (r == 128 );
46
- REQUIRE (g == 64 );
47
- REQUIRE (b == 64 );
44
+ value_color_test.setColorRGB (126 , 128 , 64 );
45
+ value_color_test.getRGB (r, g, b);
48
46
49
- value_color_test.setColorRGB (126 , 128 , 64 );
50
- value_color_test.getRGB (r, g, b);
47
+ REQUIRE (r == 126 );
48
+ REQUIRE (g == 128 );
49
+ REQUIRE (b == 64 );
51
50
52
- REQUIRE (r == 126 );
53
- REQUIRE (g == 128 );
54
- REQUIRE (b == 64 );
51
+ value_color_test.setColorRGB (64 , 128 , 64 );
52
+ value_color_test.getRGB (r, g, b);
55
53
56
- value_color_test.setColorRGB (64 , 128 , 64 );
57
- value_color_test.getRGB (r, g, b);
54
+ REQUIRE (r == 64 );
55
+ REQUIRE (g == 128 );
56
+ REQUIRE (b == 64 );
58
57
59
- REQUIRE (r == 64 );
60
- REQUIRE (g == 128 );
61
- REQUIRE (b == 64 );
58
+ value_color_test.setColorRGB (64 , 64 , 128 );
59
+ value_color_test.getRGB (r, g, b);
62
60
63
- value_color_test.setColorRGB (64 , 64 , 128 );
64
- value_color_test.getRGB (r, g, b);
61
+ REQUIRE (r == 64 );
62
+ REQUIRE (g == 64 );
63
+ REQUIRE (b == 128 );
65
64
66
- REQUIRE (r == 64 );
67
- REQUIRE (g == 64 );
68
- REQUIRE (b == 128 );
65
+ value_color_test.setColorRGB (255 , 0 , 255 );
66
+ value_color_test.getRGB (r, g, b);
69
67
70
- value_color_test.setColorRGB (255 , 0 , 255 );
71
- value_color_test.getRGB (r, g, b);
68
+ REQUIRE (r == 255 );
69
+ REQUIRE (g == 0 );
70
+ REQUIRE (b == 255 );
72
71
73
- REQUIRE (r == 255 );
74
- REQUIRE (g == 0 );
75
- REQUIRE (b == 255 );
72
+ value_color_test.setColorRGB (0 , 0 , 0 );
73
+ value_color_test.getRGB (r, g, b);
76
74
77
- value_color_test.setColorRGB (0 , 0 , 0 );
78
- value_color_test.getRGB (r, g, b);
75
+ REQUIRE (r == 0 );
76
+ REQUIRE (g == 0 );
77
+ REQUIRE (b == 0 );
79
78
80
- REQUIRE (r == 0 );
81
- REQUIRE (g == 0 );
82
- REQUIRE (b == 0 );
79
+ value_color_test.setColorRGB (50 , 100 , 20 );
80
+ value_color_test.getRGB (r, g, b);
83
81
84
- value_color_test.setColorRGB (50 , 100 , 20 );
85
- value_color_test.getRGB (r, g, b);
82
+ REQUIRE (r == 50 );
83
+ REQUIRE (g == 100 );
84
+ REQUIRE (b == 20 );
86
85
87
- REQUIRE (r == 50 );
88
- REQUIRE (g == 100 );
89
- REQUIRE (b == 20 );
86
+ value_color_test.setColorRGB (20 , 50 , 70 );
87
+ value_color_test.getRGB (r, g, b);
90
88
91
- value_color_test.setColorRGB (20 , 50 , 70 );
92
- value_color_test.getRGB (r, g, b);
93
-
94
- REQUIRE (r == 20 );
95
- REQUIRE (g == 50 );
96
- REQUIRE (b == 70 );
97
-
98
- }
89
+ REQUIRE (r == 20 );
90
+ REQUIRE (g == 50 );
91
+ REQUIRE (b == 70 );
99
92
}
100
93
101
- WHEN (" Set HSB colors and get RGB" ) {
102
- GIVEN (" CloudProtocol::V2" ) {
103
- bool verify;
104
- uint8_t r, g, b;
105
-
106
- CloudColor color_test = CloudColor (0.0 , 0.0 , 0.0 );
94
+ WHEN (" Set HSB colors and get RGB" )
95
+ {
96
+ bool verify;
97
+ uint8_t r, g, b;
107
98
108
- Color value_color_test = color_test. getValue ( );
99
+ CloudColor color_test = CloudColor ( 0.0 , 0.0 , 0.0 );
109
100
110
- value_color_test.setColorHSB (240 , 50 , 50 );
111
- value_color_test.getRGB (r, g, b);
112
- verify = r == 64 && g == 64 && b == 128 ;
101
+ Color value_color_test = color_test.getValue ();
113
102
114
- REQUIRE (verify);
103
+ value_color_test.setColorHSB (240 , 50 , 50 );
104
+ value_color_test.getRGB (r, g, b);
105
+ verify = r == 64 && g == 64 && b == 128 ;
115
106
116
- value_color_test.setColorHSB (120 , 50 , 50 );
117
- value_color_test.getRGB (r, g, b);
118
- verify = r == 64 && g == 128 && b == 64 ;
107
+ REQUIRE (verify);
119
108
120
- REQUIRE (verify);
109
+ value_color_test.setColorHSB (120 , 50 , 50 );
110
+ value_color_test.getRGB (r, g, b);
111
+ verify = r == 64 && g == 128 && b == 64 ;
121
112
122
- }
113
+ REQUIRE (verify);
123
114
}
124
115
}
0 commit comments