Skip to content

Commit

Permalink
fix(test): Use the testing time source throughout in check_server_his…
Browse files Browse the repository at this point in the history
…torical_data_circular.c
  • Loading branch information
jpfr committed Dec 26, 2023
1 parent 6674813 commit 4989087
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/server/check_server_historical_data_circular.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ setUInt32(UA_Client *thisClient, UA_NodeId node, UA_UInt32 value) {
UA_DataValue_init(&dv);
UA_Variant_setScalar(&dv.value, &value, &UA_TYPES[UA_TYPES_UINT32]);
dv.hasValue = true;
dv.sourceTimestamp = UA_DateTime_now();
dv.sourceTimestamp = UA_DateTime_now_fake(NULL);
dv.hasSourceTimestamp = true;
return UA_Client_writeValueAttributeEx(thisClient, node, &dv);
}
Expand Down Expand Up @@ -187,14 +187,14 @@ START_TEST(Server_HistorizingStrategyValueSet) {
// | 10 | 11 | 12 | 13 | 14 | 5 | 6 | 7 | 8 | 9 |
//
UA_fakeSleep(100);
UA_DateTime start = UA_DateTime_now();
UA_DateTime start = UA_DateTime_now_fake(NULL);
UA_fakeSleep(100);
for (UA_UInt32 i = 0; i < 15; ++i) {
retval = setUInt32(client, outNodeId, i);
ck_assert_str_eq(UA_StatusCode_name(retval), UA_StatusCode_name(UA_STATUSCODE_GOOD));
UA_fakeSleep(100);
}
UA_DateTime end = UA_DateTime_now();
UA_DateTime end = UA_DateTime_now_fake(NULL);

// request
UA_HistoryReadResponse response;
Expand All @@ -213,6 +213,7 @@ START_TEST(Server_HistorizingStrategyValueSet) {
UA_HistoryData * data = (UA_HistoryData *)response.results[i].historyData.content.decoded.data;
ck_assert(data->dataValuesSize > 0);
for (size_t j = 0; j < data->dataValuesSize; ++j) {
assert(data->dataValues[j].sourceTimestamp >= start && data->dataValues[j].sourceTimestamp < end);
ck_assert(data->dataValues[j].sourceTimestamp >= start && data->dataValues[j].sourceTimestamp < end);
ck_assert_uint_eq(data->dataValues[j].hasSourceTimestamp, true);
ck_assert_str_eq(UA_StatusCode_name(data->dataValues[j].status),
Expand Down

0 comments on commit 4989087

Please sign in to comment.