You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by fi...@apache.org on 2012/06/01 14:01:20 UTC
svn commit: r1345092 - in /incubator/etch/trunk/binding-cpp/runtime:
include/common/ src/main/serialization/ src/test/common/
src/test/serialization/
Author: fitzner
Date: Fri Jun 1 12:01:19 2012
New Revision: 1345092
URL: http://svn.apache.org/viewvc?rev=1345092&view=rev
Log:
ETCH-139 Implementation of EtchNativeArray
New native array implementation
Change-Id: I7ab41641ca727a9c43ccf5312837a36bd029f8d9
Modified:
incubator/etch/trunk/binding-cpp/runtime/include/common/EtchNativeArray.h
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchNativeArrayTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp
incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorStringTest.cpp
Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchNativeArray.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchNativeArray.h?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchNativeArray.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchNativeArray.h Fri Jun 1 12:01:19 2012
@@ -22,6 +22,100 @@
#include "common/EtchObject.h"
#include "common/EtchError.h"
+class Pos {
+public:
+
+ Pos(capu::int32_t i1, capu::int32_t i2 = -1, capu::int32_t i3 = -1, capu::int32_t i4 = -1, capu::int32_t i5 = -1, capu::int32_t i6 = -1, capu::int32_t i7 = -1, capu::int32_t i8 = -1, capu::int32_t i9 = -1) : size(0) {
+ if (i1 != -1) {
+ pos[0] = i1;
+ size = 1;
+ } else {
+ return;
+ }
+ if (i2 != -1) {
+ pos[1] = i2;
+ size = 2;
+ } else {
+ return;
+ }
+ if (i3 != -1) {
+ pos[2] = i3;
+ size = 3;
+ } else {
+ return;
+ }
+ if (i4 != -1) {
+ pos[3] = i4;
+ size = 4;
+ } else {
+ return;
+ }
+ if (i5 != -1) {
+ pos[4] = i5;
+ size = 5;
+ } else {
+ return;
+ }
+ if (i6 != -1) {
+ pos[5] = i6;
+ size = 6;
+ } else {
+ return;
+ }
+ if (i7 != -1) {
+ pos[6] = i7;
+ size = 7;
+ } else {
+ return;
+ }
+ if (i8 != -1) {
+ pos[7] = i8;
+ size = 8;
+ } else {
+ return;
+ }
+ if (i9 != -1) {
+ pos[8] = i9;
+ size = 9;
+ } else {
+ return;
+ }
+ }
+
+ capu::int32_t pos[9];
+ capu::int32_t size;
+};
+
+template <class T>
+class EtchArray {
+public:
+ capu::int32_t mDim;
+ capu::int32_t mLen;
+ void* mArray;
+
+ EtchArray()
+ : mDim(0), mLen(0), mArray(NULL) {
+
+ }
+
+ EtchArray(capu::int32_t dim, capu::int32_t length)
+ : mDim(dim), mLen(length), mArray(NULL) {
+ if (dim == 1) {
+ mArray = new T[length];
+ } else {
+ mArray = new EtchArray[length];
+ }
+ }
+
+ EtchArray(capu::int32_t dim, capu::int32_t length, T* array)
+ : mDim(dim), mLen(length), mArray(array) {
+
+ }
+
+ virtual ~EtchArray() {
+ }
+};
+
template<class T>
class EtchNativeArray :
public EtchObject {
@@ -35,12 +129,12 @@ public:
/**
* Constructs a EtchNativeArray object.
*/
- EtchNativeArray(capu::int32_t length, const EtchObjectType* content_type_id);
+ EtchNativeArray(capu::int32_t dim, capu::int32_t length);
/**
* Constructs a EtchNativeArray object.
*/
- EtchNativeArray(capu::int32_t length, T* array, const EtchObjectType* content_type_id);
+ EtchNativeArray(capu::int32_t dim, capu::int32_t length, T* array);
/**
* Destructor for Etch Nativearray.
@@ -49,30 +143,13 @@ public:
virtual ~EtchNativeArray();
/**
- * returns the TypeID of the content of this native array.
- */
- const EtchObjectType* getContentType();
-
- /**
* gets the EtchObject at index i in result
* returns ETCH_ERANGE, if out of bounds.
* returns ETCH_OK otherwise
*/
- status_t get(capu::int32_t index, T* result);
-
- /**
- * gets a block of EtchObject at index i in result
- * @param index The start index of the array
- * @param buffer The destination buffer
- * @param buffer_size The size of the destination buffer
- * @param offset The offset of the buffer where the data should be copied to
- * @param count The number of elements
- * returns ETCH_INVAL if the buffer is NULL
- * returns ETCH_ERANGE, if out of bounds.
- * returns ETCH_OK otherwise
- */
- status_t get(capu::int32_t index, T* buffer, capu::int32_t buffer_size, capu::int32_t offset, capu::int32_t count);
+ status_t get(Pos pos, T *result);
+ status_t get(Pos pos, capu::int32_t length, T* data, capu::int32_t offset);
/**
* sets the EtchObject at index i in result
@@ -80,41 +157,31 @@ public:
* returns ETCH_ERANGE, if out of bounds.
* returns ETCH_OK otherwise
*/
- status_t set(capu::int32_t index, T value);
+ status_t set(Pos pos, T result);
+
+ status_t set(Pos pos, capu::int32_t length, T* data, capu::int32_t offset);
/**
- * sets a block of the EtchObject at index i in result
- * if content_owned, old value will be freed.
- * @param index The start index of the array
- * @param buffer The source buffer
- * @param buffer_size The size of the source buffer
- * @param offset The offset of the buffer from where on the data should be copied
- * @param count The number of elements
- * returns ETCH_INVAL if the buffer is NULL
- * returns ETCH_ERANGE, if out of bounds.
- * returns ETCH_OK otherwise
+ * Returns the length of array
*/
- status_t set(capu::int32_t index, T* buffer, capu::int32_t buffer_size, capu::int32_t offset, capu::int32_t count);
+ capu::int32_t getLength();
/**
* Returns the length of array
*/
- capu::int32_t getLength();
+ capu::int32_t getDim();
/**
* Returns the pointer to the beginning of array
*/
T* getArray();
- /**
- * set the content type id will be deleted or not
- */
- void setDeleteMode(capu::bool_t isDelete);
+
+ status_t createArray(Pos pos, capu::int32_t dims, capu::int32_t length);
private:
- T* mArray;
- capu::bool_t mIsDeleteContentType;
- capu::int32_t mLength;
- const EtchObjectType* mContentType;
+
+ void deallocate(EtchArray<T> *array);
+ EtchArray<T> mArray;
};
template<class T>
@@ -124,103 +191,142 @@ const EtchObjectType* EtchNativeArray<T>
}
template<class T>
-EtchNativeArray<T>::EtchNativeArray(capu::int32_t length, const EtchObjectType* content_type_id)
-: EtchObject(EtchNativeArray::TYPE()), mIsDeleteContentType(false),
-mLength(length) {
- mArray = new T[length];
- mContentType = content_type_id;
+EtchNativeArray<T>::EtchNativeArray(capu::int32_t dim, capu::int32_t length)
+: EtchObject(EtchNativeArray<T>::TYPE()), mArray(dim, length) {
+
}
template<class T>
-EtchNativeArray<T>::EtchNativeArray(capu::int32_t length, T* array, const EtchObjectType* content_type_id)
-: EtchObject(EtchNativeArray::TYPE()), mArray(array), mIsDeleteContentType(false),
-mLength(length) {
- mContentType = content_type_id;
+EtchNativeArray<T>::EtchNativeArray(capu::int32_t dim, capu::int32_t length, T* array)
+: EtchObject(EtchNativeArray<T>::TYPE()), mArray(dim, length, array) {
+
}
template<class T>
EtchNativeArray<T>::~EtchNativeArray() {
- delete[] mArray;
-
- if (mIsDeleteContentType && (mContentType != NULL)) {
- const EtchObjectType * content = mContentType->getObjectComponentType();
- while (content) {
- const EtchObjectType * tmp = content;
- content = content->getObjectComponentType();
- delete tmp;
- }
- delete mContentType;
- }
+ deallocate(&mArray);
}
template<class T>
-status_t EtchNativeArray<T>::set(capu::int32_t index, T value) {
- if (0 <= index && index < mLength) {
- mArray[index] = value;
- return ETCH_OK;
- }
- return ETCH_ERANGE;
+T * EtchNativeArray<T>::getArray() {
+ return mArray;
}
template<class T>
-const EtchObjectType * EtchNativeArray<T>::getContentType() {
- return mContentType;
+status_t EtchNativeArray<T>::get(Pos pos, T * result) {
+ if (mArray.mArray == NULL || result == NULL || (pos.size != mArray.mDim)) {
+ return ETCH_EINVAL;
+ }
+ capu::int32_t i = 0;
+ void * array = mArray.mArray;
+ for (i = 1; i < mArray.mDim; i++) {
+ array = ((EtchArray<T>*) array)[pos.pos[i]].mArray;
+ }
+ *result = ((T*) array)[pos.pos[i - 1]];
+ return ETCH_OK;
}
template<class T >
-T * EtchNativeArray<T>::getArray() {
- return mArray;
+status_t EtchNativeArray<T>::set(Pos pos, T result) {
+ if (mArray.mArray == NULL || (pos.size != mArray.mDim)) {
+ return ETCH_EINVAL;
+ }
+ capu::int32_t i = 0;
+ void * array = mArray.mArray;
+ for (i = 1; i < mArray.mDim; i++) {
+ array = ((EtchArray<T>*) array)[pos.pos[i - 1]].mArray;
+ }
+ ((T*) array)[pos.pos[i - 1]] = result;
+ return ETCH_OK;
}
-template<class T >
-status_t EtchNativeArray<T>::get(capu::int32_t index, T * result) {
- if (result == NULL) {
+template<class T>
+status_t EtchNativeArray<T>::set(Pos pos, capu::int32_t length, T* data, capu::int32_t offset) {
+ if (mArray.mArray == NULL || (pos.size != mArray.mDim) || data == NULL) {
return ETCH_EINVAL;
- } else if (0 <= index && index < mLength) {
- *result = mArray[index];
- return ETCH_OK;
}
- return ETCH_ERANGE;
+ if (offset >= length) {
+ return ETCH_ERANGE;
+ }
+ capu::int32_t i = 0;
+ void * array = mArray.mArray;
+ for (i = 1; i < mArray.mDim; i++) {
+ array = ((EtchArray<T>*) array)[pos.pos[i - 1]].mArray;
+ }
+
+ for (capu::int32_t z = offset; z < length; z++) {
+ ((T*) array)[pos.pos[i - 1] + z] = data[z];
+ }
+ return ETCH_OK;
}
-template<class T >
-status_t EtchNativeArray<T>::set(capu::int32_t index, T* buffer, capu::int32_t buffer_size, capu::int32_t offset, capu::int32_t count) {
- if (buffer == NULL) {
+template<class T>
+status_t EtchNativeArray<T>::get(Pos pos, capu::int32_t length, T* data, capu::int32_t offset) {
+ if (mArray.mArray == NULL || (pos.size != mArray.mDim) || data == NULL) {
return ETCH_EINVAL;
}
- if (0 <= index && index < mLength && (mLength - index) >= count && buffer_size <= (mLength - index) && buffer_size >= count && (offset + count) <= buffer_size) {
- for (int i = 0; i < count - offset; i++, index++) {
- mArray[index] = buffer[offset + i];
- }
-
- return ETCH_OK;
+ if (offset >= length) {
+ return ETCH_ERANGE;
+ }
+ capu::int32_t i = 0;
+ void * array = mArray.mArray;
+ for (i = 1; i < mArray.mDim; i++) {
+ array = ((EtchArray<T>*) array)[pos.pos[i - 1]].mArray;
}
- return ETCH_ERANGE;
+ for (capu::int32_t z = offset; z < length; z++) {
+ data[z] = ((T*) array)[pos.pos[i - 1] + z];
+ }
+ return ETCH_OK;
}
-template<class T >
-status_t EtchNativeArray<T>::get(capu::int32_t index, T* buffer, capu::int32_t buffer_size, capu::int32_t offset, capu::int32_t count) {
- if (buffer == NULL) {
+template<class T>
+capu::int32_t EtchNativeArray<T>::getLength() {
+ return mArray.mLen;
+}
+
+template<class T>
+status_t EtchNativeArray<T>::createArray(Pos pos, capu::int32_t dim, capu::int32_t length) {
+ if (mArray.mArray == NULL || (pos.size >= mArray.mDim)) {
return ETCH_EINVAL;
}
- if (0 <= index && index < mLength && (mLength - index) >= count && buffer_size >= (mLength - index) && buffer_size >= count && (offset + count) <= buffer_size) {
+ capu::int32_t i = 0;
+ void * array = mArray.mArray;
+ for (i = 0; i < pos.size - 1; i++) {
+ array = ((EtchArray<T>*) array)[pos.pos[i]].mArray;
+ }
- for (int i = 0; i < count - offset; i++, index++) {
- buffer[offset + i] = mArray[index];
- }
+ ((EtchArray<T>*) array)[pos.pos[i]].mDim = dim;
+ ((EtchArray<T>*) array)[pos.pos[i]].mLen = length;
- return ETCH_OK;
+ if (dim > 1) {
+ ((EtchArray<T>*) array)[pos.pos[i]].mArray = new EtchArray<T>[length];
+ } else if (dim == 1) {
+ ((EtchArray<T>*) array)[pos.pos[i]].mArray = new T[length];
}
- return ETCH_ERANGE;
+ return ETCH_OK;
}
-template<class T >
-capu::int32_t EtchNativeArray<T>::getLength() {
- return mLength;
+template<class T>
+void EtchNativeArray<T>::deallocate(EtchArray<T> *array) {
+
+ if (array == NULL)
+ return;
+ else if (array->mDim == 1)
+ delete [] (T*) array->mArray;
+ else if (array->mDim < 0)
+ return;
+ else {
+ capu::int32_t i;
+ for (i = 0; i < array->mLen; i++) {
+ deallocate(&((EtchArray<T>*) array->mArray)[i]);
+ }
+ delete [] (EtchArray<T>*) array->mArray;
+ }
}
template<class T>
-void EtchNativeArray<T>::setDeleteMode(capu::bool_t isDelete) {
- mIsDeleteContentType = isDelete;
+capu::int32_t EtchNativeArray<T>::getDim() {
+ return mArray.mDim;
}
+
#endif //__ETCHNATIVEARRAY_H__
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchTypeValidator.cpp Fri Jun 1 12:01:19 2012
@@ -26,11 +26,7 @@ EtchTypeValidator::EtchTypeValidator(con
if (mNDims == 0)
mExpectedType = new EtchObjectType(scalarClass->getTypeId(),scalarClass->getObjectComponentType());
else if (mNDims > 0){
- EtchObjectType *type = new EtchObjectType(scalarClass->getTypeId(), NULL);
- for(capu::uint32_t i = 0 ; i < mNDims ;i++)
- {
- type = new EtchObjectType(EOTID_NATIVE_ARRAY, type);
- }
+ EtchObjectType *type = new EtchObjectType(EOTID_NATIVE_ARRAY, scalarClass);
mExpectedType = type;
mArrayComponentType = scalarClass;
}
@@ -38,14 +34,6 @@ EtchTypeValidator::EtchTypeValidator(con
}
EtchTypeValidator::~EtchTypeValidator(){
- const EtchObjectType *type;
- type = mExpectedType->getObjectComponentType();
- while(type != NULL)
- {
- const EtchObjectType *tmp = type;
- type = type->getObjectComponentType();
- delete tmp;
- }
delete mExpectedType;
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorBoolean.cpp Fri Jun 1 12:01:19 2012
@@ -47,16 +47,11 @@ capu::bool_t EtchValidatorBoolean::valid
//array handling
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
- const EtchObjectType* type = array->getContentType();
- const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
- while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
- type = type->getObjectComponentType();
- type2 = type2->getObjectComponentType();
- }
- //both of them should be pointing null
- if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+ if (array->getDim() != mNDims) {
return false;
}
+ const EtchObjectType* type = array->getObjectType()->getObjectComponentType();
+ const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
return false;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorByte.cpp Fri Jun 1 12:01:19 2012
@@ -61,17 +61,11 @@ capu::bool_t EtchValidatorByte::validate
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
- const EtchObjectType* type = array->getContentType();
- const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
- while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
- type = type->getObjectComponentType();
- type2 = type2->getObjectComponentType();
- }
-
- //both of them should be pointing null
- if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+ if (array->getDim() != mNDims) {
return false;
}
+ const EtchObjectType* type = array->getObjectType()->getObjectComponentType();
+ const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorDouble.cpp Fri Jun 1 12:01:19 2012
@@ -46,19 +46,12 @@ capu::bool_t EtchValidatorDouble::valida
//handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
-
EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
- const EtchObjectType* type = array->getContentType();
- const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
- while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
- type = type->getObjectComponentType();
- type2 = type2->getObjectComponentType();
- }
-
- //both of them should be pointing null
- if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+ if (array->getDim() != mNDims) {
return false;
}
+ const EtchObjectType* type = array->getObjectType()->getObjectComponentType();
+ const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
return false;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorFloat.cpp Fri Jun 1 12:01:19 2012
@@ -45,19 +45,12 @@ capu::bool_t EtchValidatorFloat::validat
//array handling
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
-
EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
- const EtchObjectType* type = array->getContentType();
- const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
- while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
- type = type->getObjectComponentType();
- type2 = type2->getObjectComponentType();
- }
-
- //both of them should be pointing null
- if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+ if (array->getDim() != mNDims) {
return false;
}
+ const EtchObjectType* type = array->getObjectType()->getObjectComponentType();
+ const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
return false;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorInt.cpp Fri Jun 1 12:01:19 2012
@@ -55,19 +55,12 @@ capu::bool_t EtchValidatorInt::validate(
//handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
-
EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
- const EtchObjectType* type = array->getContentType();
- const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
- while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
- type = type->getObjectComponentType();
- type2 = type2->getObjectComponentType();
- }
-
- //both of them should be pointing null
- if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+ if (array->getDim() != mNDims) {
return false;
}
+ const EtchObjectType* type = array->getObjectType()->getObjectComponentType();
+ const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorLong.cpp Fri Jun 1 12:01:19 2012
@@ -51,19 +51,12 @@ capu::bool_t EtchValidatorLong::validate
//handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
-
EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
- const EtchObjectType* type = array->getContentType();
- const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
- while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
- type = type->getObjectComponentType();
- type2 = type2->getObjectComponentType();
- }
-
- //both of them should be pointing null
- if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+ if (array->getDim() != mNDims) {
return false;
}
+ const EtchObjectType* type = array->getObjectType()->getObjectComponentType();
+ const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorShort.cpp Fri Jun 1 12:01:19 2012
@@ -59,19 +59,12 @@ capu::bool_t EtchValidatorShort::validat
}
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
-
EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
- const EtchObjectType* type = array->getContentType();
- const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
- while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
- type = type->getObjectComponentType();
- type2 = type2->getObjectComponentType();
- }
-
- //both of them should be pointing null
- if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+ if (array->getDim() != mNDims) {
return false;
}
+ const EtchObjectType* type = array->getObjectType()->getObjectComponentType();
+ const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
return false;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorString.cpp Fri Jun 1 12:01:19 2012
@@ -43,19 +43,12 @@ capu::bool_t EtchValidatorString::valida
return true;
// handle array
if ((value->getObjectType()->isArray()) && (mExpectedType->isArray())) {
-
EtchNativeArray<EtchObject*> *array = (EtchNativeArray<EtchObject*> *) value;
- const EtchObjectType* type = array->getContentType();
- const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
- while ((type->getObjectComponentType() != NULL) && (mExpectedType->getObjectComponentType() != NULL)) {
- type = type->getObjectComponentType();
- type2 = type2->getObjectComponentType();
- }
-
- //both of them should be pointing null
- if (type->getObjectComponentType() != type2->getObjectComponentType()) {
+ if (array->getDim() != mNDims) {
return false;
}
+ const EtchObjectType* type = array->getObjectType()->getObjectComponentType();
+ const EtchObjectType* type2 = mExpectedType->getObjectComponentType();
return type->equals(type2);
}
return false;
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchNativeArrayTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchNativeArrayTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchNativeArrayTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/common/EtchNativeArrayTest.cpp Fri Jun 1 12:01:19 2012
@@ -21,7 +21,8 @@
#include "common/EtchNativeArray.h"
TEST(EtchNativeArrayTest, Constructor_Default) {
- EtchNativeArray<EtchInt32*>* na = new EtchNativeArray<EtchInt32*>(10, EtchInt32::TYPE());
+ EtchNativeArray<EtchInt32*>* na =
+ new EtchNativeArray<EtchInt32*>(1, 2);
delete na;
}
@@ -30,8 +31,7 @@ TEST(EtchNativeArrayTest, Constructor_Ar
EtchInt32* int1 = new EtchInt32(42);
EtchInt32* int2 = new EtchInt32(43);
- EtchNativeArray<EtchInt32*>* na1 =
- new EtchNativeArray<EtchInt32*>(2, EtchInt32::TYPE());
+ EtchNativeArray<EtchInt32*>* na1 = new EtchNativeArray<EtchInt32*>(1, 2);
na1->set(0, int1);
na1->set(1, int2);
@@ -39,16 +39,13 @@ TEST(EtchNativeArrayTest, Constructor_Ar
EXPECT_TRUE(na1->getObjectType()->equals(EtchNativeArray<EtchInt32*>::TYPE()));
EtchInt32* value = NULL;
- int i = 0;
+ capu::int32_t i = 0;
for (i = 0; i < 2; i++) {
status_t ret = na1->get(i, &value);
ASSERT_EQ(ETCH_OK, ret);
ASSERT_EQ(42 + i, value->get());
}
- status_t ret = na1->get(i, &value);
- ASSERT_EQ(ETCH_ERANGE, ret);
-
delete na1;
delete int1;
delete int2;
@@ -59,7 +56,7 @@ TEST(EtchNativeArrayTest, setget) {
EtchInt32* int1 = new EtchInt32(42);
EtchInt32* int2 = new EtchInt32(43);
EtchNativeArray<EtchInt32*>* na1 =
- new EtchNativeArray<EtchInt32*>(2, EtchInt32::TYPE());
+ new EtchNativeArray<EtchInt32*>(1, 2);
EXPECT_TRUE(na1->getObjectType()->equals(EtchNativeArray<EtchInt32*>::TYPE()));
na1->set(0, int1);
@@ -82,7 +79,7 @@ TEST(EtchNativeArrayTest, setget) {
ASSERT_EQ(44, newValue->get());
//Test setget of block
- EtchNativeArray<EtchInt32*> *native_array = new EtchNativeArray<EtchInt32*> (2, EtchInt32::TYPE());
+ EtchNativeArray<EtchInt32*> *native_array = new EtchNativeArray<EtchInt32*> (1, 2);
EtchInt32** int3 = new EtchInt32*[2];
int3[0] = new EtchInt32();
int3[1] = new EtchInt32();
@@ -90,66 +87,61 @@ TEST(EtchNativeArrayTest, setget) {
int3[0]->set(2);
int3[1]->set(4);
- ret = native_array->set(0, NULL, 0, 0, 0);
+ ret = native_array->set(0, 0, NULL, 0);
EXPECT_TRUE(ret == ETCH_EINVAL);
- ret = native_array->get(0, NULL, 0, 0, 0);
+ ret = native_array->get(0, 0, NULL, 0);
EXPECT_TRUE(ret == ETCH_EINVAL);
- ret = native_array->set(0, int3, 2, 0, 2);
+ ret = native_array->set(0, 2, int3, 0);
EXPECT_TRUE(ret == ETCH_OK);
+ ret = native_array->get(0, &value);
+ EXPECT_TRUE(value->get() == 2);
+
EtchInt32** int6 = new EtchInt32*[2];
- ret = native_array->get(0, int6, 2, 0, 2);
+ ret = native_array->get(0, 2, int6, 0);
EXPECT_TRUE(ret == ETCH_OK);
EXPECT_TRUE(int6[0]->get() == 2);
EXPECT_TRUE(int6[1]->get() == 4);
//Test setget of block of native type
- EtchNativeArray<int> *native_array2 = new EtchNativeArray<int> (2, &EtchObjectType::NATIVE_INT32);
+ EtchNativeArray<int> *native_array2 = new EtchNativeArray<int> (1, 2);
capu::int32_t int4[2];
capu::int32_t int5[2];
int4[0] = 3;
int4[1] = 5;
- ret = native_array2->set(0, NULL, 0, 0, 0);
+ ret = native_array2->set(0, 0, NULL, 0);
EXPECT_TRUE(ret == ETCH_EINVAL);
- ret = native_array2->get(0, NULL, 0, 0, 0);
+ ret = native_array2->get(0, 0, NULL, 0);
EXPECT_TRUE(ret == ETCH_EINVAL);
- ret = native_array2->set(0, (int*) int4, 2, 0, 2);
+ ret = native_array2->set(0, 2, (int*) int4, 0);
EXPECT_TRUE(ret == ETCH_OK);
- ret = native_array2->get(0, (int*) int5, 2, 0, 2);
+ ret = native_array2->get(0, 2, (int*) int5, 0);
EXPECT_TRUE(ret == ETCH_OK);
EXPECT_TRUE(int5[0] == 3);
EXPECT_TRUE(int5[1] == 5);
- //index out of bounds
- ret = native_array2->set(5, (int*) int4, 2, 0, 2);
- EXPECT_TRUE(ret == ETCH_ERANGE);
-
//buffer size smaller then count
- ret = native_array2->set(0, (int*) int4, 1, 0, 2);
+ ret = native_array2->set(0, 1, (int*) int4, 2);
EXPECT_TRUE(ret == ETCH_ERANGE);
//offset + count out of range
- ret = native_array2->set(0, (int*) int4, 2, 2, 2);
- EXPECT_TRUE(ret == ETCH_ERANGE);
-
- //index out of bounds
- ret = native_array2->get(5, (int*) int5, 2, 0, 2);
+ ret = native_array2->set(0, 2, (int*) int4, 2);
EXPECT_TRUE(ret == ETCH_ERANGE);
//buffer size smaller then count
- ret = native_array2->get(0, (int*) int5, 1, 0, 2);
+ ret = native_array2->get(0, 1, (int*) int5, 2);
EXPECT_TRUE(ret == ETCH_ERANGE);
//offset + count out of range
- ret = native_array2->set(0, (int*) int5, 2, 2, 2);
+ ret = native_array2->set(0, 2, (int*) int5, 2);
EXPECT_TRUE(ret == ETCH_ERANGE);
delete int3[0];
@@ -171,28 +163,20 @@ TEST(EtchNativeArrayTest, multiDimension
EtchInt32* int3 = new EtchInt32(3);
EtchInt32* int4 = new EtchInt32(4);
- EtchNativeArray<EtchInt32*>* subArray1 = new EtchNativeArray<EtchInt32*>(2, EtchInt32::TYPE());
- EtchNativeArray<EtchInt32*>* subArray2 = new EtchNativeArray<EtchInt32*>(2, EtchInt32::TYPE());
- subArray1->set(0, int1);
- subArray1->set(1, int2);
- subArray2->set(0, int3);
- subArray2->set(1, int4);
-
- EtchNativeArray<EtchNativeArray<EtchInt32*>*>* mainArray = new EtchNativeArray<EtchNativeArray<EtchInt32*>*>(2, EtchNativeArray<EtchNativeArray<EtchInt32*>*>::TYPE());
- mainArray->set(0, subArray1);
- mainArray->set(1, subArray2);
+ EtchNativeArray<EtchInt32*>* mainArray = new EtchNativeArray<EtchInt32*>(2, 2);
+
const EtchObjectType *ot = mainArray->getObjectType();
//get type of main array
- EXPECT_TRUE(ot->equals(EtchNativeArray<EtchNativeArray<EtchInt32*>*>::TYPE()));
- //get component type of main array = type of subarray
- EXPECT_TRUE(ot->getObjectComponentType()->equals(EtchNativeArray<EtchInt32*>::TYPE()));
- //get component type of subarray
- EXPECT_TRUE(ot->getObjectComponentType()->getObjectComponentType()->equals(EtchInt32::TYPE()));
+ EXPECT_TRUE(ot->equals(EtchNativeArray<EtchInt32*>::TYPE()));
- EtchNativeArray<EtchInt32*>* result;
- mainArray->get(0, &result);
EtchInt32* int5;
- result->get(0, &int5);
+ mainArray->createArray(Pos(0), 1, 2);
+ mainArray->createArray(Pos(1), 1, 2);
+ mainArray->set(Pos(0, 0), int1);
+ mainArray->set(Pos(0, 1), int2);
+ mainArray->set(Pos(1, 0), int3);
+ mainArray->set(Pos(1, 1), int4);
+ mainArray->get(Pos(0, 0), &int5);
EXPECT_EQ(1, int5->get());
delete int1;
@@ -200,21 +184,5 @@ TEST(EtchNativeArrayTest, multiDimension
delete int3;
delete int4;
- delete subArray1;
- delete subArray2;
delete mainArray;
-}
-
-TEST(EtchNativeArrayTest, DeleteModeTest) {
- EtchNativeArray<EtchInt32*>* Array1 = new EtchNativeArray<EtchInt32*>(2, EtchInt32::TYPE());
- Array1->setDeleteMode(false);
- EtchNativeArray<EtchInt32*>* Array2 = new EtchNativeArray<EtchInt32*>(2, new EtchObjectType(EOTID_INT32, NULL));
- Array2->setDeleteMode(true);
- EtchNativeArray<EtchInt32*>* Array3 = new EtchNativeArray<EtchInt32*>(2, NULL);
- Array3->setDeleteMode(true);
-
-
- delete Array1;
- delete Array2;
- delete Array3;
-}
+}
\ No newline at end of file
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorBooleanTest.cpp Fri Jun 1 12:01:19 2012
@@ -33,12 +33,11 @@ TEST(EtchValidatorBooleanTest, createTes
EtchObjectType type1(EOTID_BOOL, NULL);
EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
- EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
EXPECT_TRUE(EtchValidatorBoolean::Get(2, val2) == ETCH_OK);
val = capu::smartpointer_cast<EtchValidatorBoolean>(val2);
EXPECT_TRUE(val.get() != NULL);
- EXPECT_TRUE(val->getExpectedType()->equals(&type3));
+ EXPECT_TRUE(val->getExpectedType()->equals(&type2));
EXPECT_TRUE(val->getNDims() == 2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorByteTest.cpp Fri Jun 1 12:01:19 2012
@@ -32,10 +32,9 @@ TEST(EtchValidatorByteTest, createTest)
EtchObjectType type1(EOTID_BYTE, NULL);
EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
- EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
EXPECT_TRUE(EtchValidatorByte::Get(2, val) == ETCH_OK);
ptr = capu::smartpointer_cast<EtchValidatorByte>(val);
- EXPECT_TRUE(ptr->getExpectedType()->equals(&type3));
+ EXPECT_TRUE(ptr->getExpectedType()->equals(&type2));
EXPECT_TRUE(ptr->getNDims() == 2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorDoubleTest.cpp Fri Jun 1 12:01:19 2012
@@ -33,11 +33,10 @@ TEST(EtchValidatorDoubleTest, createTest
EtchObjectType type1(EOTID_DOUBLE, NULL);
EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
- EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
EXPECT_TRUE(EtchValidatorDouble::Get(2, val) == ETCH_OK);
ptr = capu::smartpointer_cast<EtchValidatorDouble>(val);
- EXPECT_TRUE(ptr->getExpectedType()->equals(&type3));
+ EXPECT_TRUE(ptr->getExpectedType()->equals(&type2));
EXPECT_TRUE(ptr->getNDims() == 2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorFloatTest.cpp Fri Jun 1 12:01:19 2012
@@ -34,11 +34,10 @@ TEST(EtchValidatorFloatTest, createTest)
EtchObjectType type1(EOTID_FLOAT, NULL);
EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
- EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
EXPECT_TRUE(EtchValidatorFloat::Get(2, val) == ETCH_OK);
ptr = capu::smartpointer_cast<EtchValidatorFloat>(val);
- EXPECT_TRUE(ptr->getExpectedType()->equals(&type3));
+ EXPECT_TRUE(ptr->getExpectedType()->equals(&type2));
EXPECT_TRUE(ptr->getNDims() == 2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorIntTest.cpp Fri Jun 1 12:01:19 2012
@@ -31,10 +31,9 @@ TEST(EtchValidatorIntTest, createTest) {
EtchObjectType type1(EOTID_INT32, NULL);
EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
- EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
EXPECT_TRUE(EtchValidatorInt::Get(2, val) == ETCH_OK);
ptr = capu::smartpointer_cast<EtchValidatorInt>(val);
- EXPECT_TRUE(ptr->getExpectedType()->equals(&type3));
+ EXPECT_TRUE(ptr->getExpectedType()->equals(&type2));
EXPECT_TRUE(ptr->getNDims() == 2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorLongTest.cpp Fri Jun 1 12:01:19 2012
@@ -33,10 +33,9 @@ TEST(EtchValidatorLongTest, createTest)
EtchObjectType type1(EOTID_LONG, NULL);
EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
- EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
EXPECT_TRUE(EtchValidatorLong::Get(2, val) == ETCH_OK);
ptr = capu::smartpointer_cast<EtchValidatorLong>(val);
- EXPECT_TRUE(ptr->getExpectedType()->equals(&type3));
+ EXPECT_TRUE(ptr->getExpectedType()->equals(&type2));
EXPECT_TRUE(ptr->getNDims() == 2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorShortTest.cpp Fri Jun 1 12:01:19 2012
@@ -31,10 +31,9 @@ TEST(EtchValidatorShortTest, createTest)
EtchObjectType type1(EOTID_SHORT, NULL);
EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
- EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
EXPECT_TRUE(EtchValidatorShort::Get(2, val) == ETCH_OK);
ptr = capu::smartpointer_cast<EtchValidatorShort>(val);
- EXPECT_TRUE(ptr->getExpectedType()->equals(&type3));
+ EXPECT_TRUE(ptr->getExpectedType()->equals(&type2));
EXPECT_TRUE(ptr->getNDims() == 2);
}
Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorStringTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorStringTest.cpp?rev=1345092&r1=1345091&r2=1345092&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorStringTest.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/serialization/EtchValidatorStringTest.cpp Fri Jun 1 12:01:19 2012
@@ -33,10 +33,9 @@ TEST(EtchValidatorStringTest, createTest
EtchObjectType type1(EOTID_STRING, NULL);
EtchObjectType type2(EOTID_NATIVE_ARRAY, &type1);
- EtchObjectType type3(EOTID_NATIVE_ARRAY, &type2);
EXPECT_TRUE(EtchValidatorString::Get(2, val) == ETCH_OK);
ptr = capu::smartpointer_cast<EtchValidatorString>(val);
- EXPECT_TRUE(ptr->getExpectedType()->equals(&type3));
+ EXPECT_TRUE(ptr->getExpectedType()->equals(&type2));
EXPECT_TRUE(ptr->getNDims() == 2);
}