|
@@ -12,11 +12,11 @@ START_TEST(newAndEmptyObjectShallBeDeleted) {
|
|
|
UA_Int32 retval;
|
|
|
void *obj;
|
|
|
// when
|
|
|
- retval = UA_.types[_i].new(&obj);
|
|
|
+ retval = UA_[_i].new(&obj);
|
|
|
#ifdef DEBUG //no print functions if not in debug mode
|
|
|
- UA_.types[_i].print(obj, stdout);
|
|
|
+ UA_[_i].print(obj, stdout);
|
|
|
#endif
|
|
|
- UA_.types[_i].delete(obj);
|
|
|
+ UA_[_i].delete(obj);
|
|
|
// then
|
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
|
}
|
|
@@ -30,7 +30,7 @@ START_TEST(arrayCopyShallMakeADeepCopy) {
|
|
|
a1[2] = (UA_String){3, (UA_Byte*)"ccc"};
|
|
|
// when
|
|
|
UA_String *a2;
|
|
|
- UA_Int32 retval = UA_Array_copy((const void *)a1, 3, &UA_.types[UA_STRING], (void **)&a2);
|
|
|
+ UA_Int32 retval = UA_Array_copy((const void *)a1, 3, &UA_[UA_STRING], (void **)&a2);
|
|
|
// then
|
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
|
ck_assert_int_eq(a1[0].length, 1);
|
|
@@ -46,7 +46,7 @@ START_TEST(arrayCopyShallMakeADeepCopy) {
|
|
|
ck_assert_int_eq(a1[1].data[0], a2[1].data[0]);
|
|
|
ck_assert_int_eq(a1[2].data[0], a2[2].data[0]);
|
|
|
// finally
|
|
|
- UA_Array_delete((void *)a2, 3, &UA_.types[UA_STRING]);
|
|
|
+ UA_Array_delete((void *)a2, 3, &UA_[UA_STRING]);
|
|
|
}
|
|
|
END_TEST
|
|
|
|
|
@@ -56,31 +56,31 @@ START_TEST(encodeShallYieldDecode) {
|
|
|
UA_ByteString msg1, msg2;
|
|
|
UA_Int32 retval;
|
|
|
UA_UInt32 pos = 0;
|
|
|
- retval = UA_.types[_i].new(&obj1);
|
|
|
- UA_ByteString_newMembers(&msg1, UA_.types[_i].encodings[UA_ENCODING_BINARY].calcSize(obj1));
|
|
|
- retval |= UA_.types[_i].encodings[UA_ENCODING_BINARY].encode(obj1, &msg1, &pos);
|
|
|
+ retval = UA_[_i].new(&obj1);
|
|
|
+ UA_ByteString_newMembers(&msg1, UA_[_i].encodings[UA_ENCODING_BINARY].calcSize(obj1));
|
|
|
+ retval |= UA_[_i].encodings[UA_ENCODING_BINARY].encode(obj1, &msg1, &pos);
|
|
|
if(retval != UA_SUCCESS) {
|
|
|
- // this happens, e.g. when we encode a variant (with UA_.types[UA_INVALIDTYPE] in the vtable)
|
|
|
- UA_.types[_i].delete(obj1);
|
|
|
+ // this happens, e.g. when we encode a variant (with UA_[UA_INVALIDTYPE] in the vtable)
|
|
|
+ UA_[_i].delete(obj1);
|
|
|
UA_ByteString_deleteMembers(&msg1);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// when
|
|
|
- UA_.types[_i].new(&obj2);
|
|
|
- pos = 0; retval = UA_.types[_i].encodings[UA_ENCODING_BINARY].decode(&msg1, &pos, obj2);
|
|
|
- ck_assert_msg(retval == UA_SUCCESS, "messages differ idx=%d,name=%s", _i, UA_.types[_i].name);
|
|
|
- retval = UA_ByteString_newMembers(&msg2, UA_.types[_i].encodings[UA_ENCODING_BINARY].calcSize(obj2));
|
|
|
+ UA_[_i].new(&obj2);
|
|
|
+ pos = 0; retval = UA_[_i].encodings[UA_ENCODING_BINARY].decode(&msg1, &pos, obj2);
|
|
|
+ ck_assert_msg(retval == UA_SUCCESS, "messages differ idx=%d,name=%s", _i, UA_[_i].name);
|
|
|
+ retval = UA_ByteString_newMembers(&msg2, UA_[_i].encodings[UA_ENCODING_BINARY].calcSize(obj2));
|
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
|
- pos = 0; retval = UA_.types[_i].encodings[UA_ENCODING_BINARY].encode(obj2, &msg2, &pos);
|
|
|
+ pos = 0; retval = UA_[_i].encodings[UA_ENCODING_BINARY].encode(obj2, &msg2, &pos);
|
|
|
ck_assert_int_eq(retval, UA_SUCCESS);
|
|
|
|
|
|
// then
|
|
|
- ck_assert_msg(UA_ByteString_equal(&msg1, &msg2) == 0, "messages differ idx=%d,name=%s", _i, UA_.types[_i].name);
|
|
|
+ ck_assert_msg(UA_ByteString_equal(&msg1, &msg2) == 0, "messages differ idx=%d,name=%s", _i, UA_[_i].name);
|
|
|
|
|
|
// finally
|
|
|
- UA_.types[_i].delete(obj1);
|
|
|
- UA_.types[_i].delete(obj2);
|
|
|
+ UA_[_i].delete(obj1);
|
|
|
+ UA_[_i].delete(obj2);
|
|
|
UA_ByteString_deleteMembers(&msg1);
|
|
|
UA_ByteString_deleteMembers(&msg2);
|
|
|
}
|
|
@@ -91,20 +91,20 @@ START_TEST(decodeShallFailWithTruncatedBufferButSurvive) {
|
|
|
void *obj1 = UA_NULL, *obj2 = UA_NULL;
|
|
|
UA_ByteString msg1;
|
|
|
UA_UInt32 pos;
|
|
|
- UA_.types[_i].new(&obj1);
|
|
|
- UA_ByteString_newMembers(&msg1, UA_.types[_i].encodings[0].calcSize(obj1));
|
|
|
- pos = 0; UA_.types[_i].encodings[0].encode(obj1, &msg1, &pos);
|
|
|
- UA_.types[_i].delete(obj1);
|
|
|
+ UA_[_i].new(&obj1);
|
|
|
+ UA_ByteString_newMembers(&msg1, UA_[_i].encodings[0].calcSize(obj1));
|
|
|
+ pos = 0; UA_[_i].encodings[0].encode(obj1, &msg1, &pos);
|
|
|
+ UA_[_i].delete(obj1);
|
|
|
// when
|
|
|
- UA_.types[_i].new(&obj2);
|
|
|
+ UA_[_i].new(&obj2);
|
|
|
pos = 0;
|
|
|
msg1.length = msg1.length / 2;
|
|
|
//fprintf(stderr,"testing %s with half buffer\n",UA_[_i].name);
|
|
|
- UA_.types[_i].encodings[0].decode(&msg1, &pos, obj2);
|
|
|
+ UA_[_i].encodings[0].decode(&msg1, &pos, obj2);
|
|
|
//then
|
|
|
// finally
|
|
|
//fprintf(stderr,"delete %s with half buffer\n",UA_[_i].name);
|
|
|
- UA_.types[_i].delete(obj2);
|
|
|
+ UA_[_i].delete(obj2);
|
|
|
UA_ByteString_deleteMembers(&msg1);
|
|
|
}
|
|
|
END_TEST
|
|
@@ -132,12 +132,12 @@ START_TEST(decodeScalarBasicTypeFromRandomBufferShallSucceed) {
|
|
|
#endif
|
|
|
}
|
|
|
UA_UInt32 pos = 0;
|
|
|
- retval |= UA_.types[_i].new(&obj1);
|
|
|
- retval |= UA_.types[_i].encodings[0].decode(&msg1, &pos, obj1);
|
|
|
+ retval |= UA_[_i].new(&obj1);
|
|
|
+ retval |= UA_[_i].encodings[0].decode(&msg1, &pos, obj1);
|
|
|
//then
|
|
|
- ck_assert_msg(retval == UA_SUCCESS, "Decoding %s from random buffer", UA_.types[_i].name);
|
|
|
+ ck_assert_msg(retval == UA_SUCCESS, "Decoding %s from random buffer", UA_[_i].name);
|
|
|
// finally
|
|
|
- UA_.types[_i].delete(obj1);
|
|
|
+ UA_[_i].delete(obj1);
|
|
|
}
|
|
|
UA_ByteString_deleteMembers(&msg1);
|
|
|
}
|
|
@@ -167,13 +167,13 @@ START_TEST(decodeComplexTypeFromRandomBufferShallSurvive) {
|
|
|
#endif
|
|
|
}
|
|
|
UA_UInt32 pos = 0;
|
|
|
- retval |= UA_.types[_i].new(&obj1);
|
|
|
- retval |= UA_.types[_i].encodings[0].decode(&msg1, &pos, obj1);
|
|
|
+ retval |= UA_[_i].new(&obj1);
|
|
|
+ retval |= UA_[_i].encodings[0].decode(&msg1, &pos, obj1);
|
|
|
|
|
|
//this is allowed to fail and return UA_ERROR
|
|
|
- //ck_assert_msg(retval == UA_SUCCESS, "Decoding %s from random buffer", UA_.types[_i].name);
|
|
|
+ //ck_assert_msg(retval == UA_SUCCESS, "Decoding %s from random buffer", UA_[_i].name);
|
|
|
|
|
|
- UA_.types[_i].delete(obj1);
|
|
|
+ UA_[_i].delete(obj1);
|
|
|
}
|
|
|
|
|
|
// finally
|