Skip to content

Commit 653aa87

Browse files
authored
Merge pull request #1 from rzr/SiliconLabsGH-20/UIC-3082/phcoval/main
SiliconLabsGH-14: Enable testing by default
2 parents db3a8e6 + dd870bd commit 653aa87

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

applications/zpc/components/zwave_command_classes/test/zwave_command_class_meter_control_test.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ void test_meter_supported_get_v1()
255255
{
256256
// Simulate a version 1 node.
257257
attribute_store_node_t version_node = attribute_store_add_node(
258-
ZWAVE_CC_VERSION_ATTRIBUTE(COMMAND_CLASS_METER_V5),
258+
ZWAVE_CC_VERSION_ATTRIBUTE(COMMAND_CLASS_METER),
259259
endpoint_id_node);
260260

261261
const zwave_cc_version_t version = 1;
@@ -270,7 +270,7 @@ void test_meter_supported_get_v1()
270270
received_frame,
271271
&received_frame_size);
272272

273-
const uint8_t expected_frame[] = {COMMAND_CLASS_METER_V5, METER_GET, 0, 0};
273+
const uint8_t expected_frame[] = {COMMAND_CLASS_METER, METER_GET};
274274
TEST_ASSERT_EQUAL(sizeof(expected_frame), received_frame_size);
275275
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_frame,
276276
received_frame,
@@ -307,6 +307,15 @@ void test_meter_supported_get_v2()
307307

308308
void test_meter_get_low_scale()
309309
{
310+
// Simulate a version 2 node.
311+
attribute_store_node_t version_node = attribute_store_add_node(
312+
ZWAVE_CC_VERSION_ATTRIBUTE(COMMAND_CLASS_METER_V2),
313+
endpoint_id_node);
314+
315+
const zwave_cc_version_t version = 2;
316+
attribute_store_set_reported(version_node, &version, sizeof(version));
317+
318+
310319
attribute_store_node_t meter_type_node
311320
= attribute_store_add_node(ATTRIBUTE(TYPE), endpoint_id_node);
312321
const meter_type_t type = 3;
@@ -328,7 +337,7 @@ void test_meter_get_low_scale()
328337
meter_get(value_node, received_frame, &received_frame_size));
329338

330339
const uint8_t expected_frame[]
331-
= {COMMAND_CLASS_METER_V5, METER_GET, (rate_type << 6) | (scale << 3), 0};
340+
= {COMMAND_CLASS_METER_V2, METER_GET_V2, (rate_type << 6) | (scale << 3)};
332341
TEST_ASSERT_EQUAL(sizeof(expected_frame), received_frame_size);
333342
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_frame,
334343
received_frame,
@@ -337,6 +346,14 @@ void test_meter_get_low_scale()
337346

338347
void test_meter_get_high_scale()
339348
{
349+
// Simulate a version 4 node.
350+
attribute_store_node_t version_node = attribute_store_add_node(
351+
ZWAVE_CC_VERSION_ATTRIBUTE(COMMAND_CLASS_METER_V4),
352+
endpoint_id_node);
353+
354+
const zwave_cc_version_t version = 4;
355+
attribute_store_set_reported(version_node, &version, sizeof(version));
356+
340357
attribute_store_node_t meter_type_node
341358
= attribute_store_add_node(ATTRIBUTE(TYPE), endpoint_id_node);
342359
const meter_type_t type = 1;

helper.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ zpc/build: zpc/configure build
156156
zpc/test: ${build_dir}/applications/zpc/components/zwave_command_classes/test/
157157
ctest --test-dir ${<}
158158

159-
zpc/default: zpc/configure zpc/build
159+
zpc/default: zpc/configure zpc/build zpc/test
160160
@date -u
161161

162162
### @rootfs is faster than docker for env check

0 commit comments

Comments
 (0)