Beispiel #1
0
void UT_array(const char* params)
{
	Lumix::DefaultAllocator allocator;

	Lumix::Array<int> array1(allocator);
	LUMIX_EXPECT(array1.empty());
	LUMIX_EXPECT(array1.size() == 0);
	array1.reserve(128);
	LUMIX_EXPECT(array1.size() == 0);
	LUMIX_EXPECT(array1.capacity() == 128);
	array1.reserve(256);
	LUMIX_EXPECT(array1.capacity() == 256);
	array1.reserve(64);
	LUMIX_EXPECT(array1.capacity() >= 64);
	LUMIX_EXPECT(array1.size() == 0);

	for (int i = 0; i < 10; ++i)
	{
		array1.push(i * 2);
		LUMIX_EXPECT(array1[i] == i * 2);
		LUMIX_EXPECT(array1.back() == i * 2);
		LUMIX_EXPECT(array1.indexOf(i*2) == i);
	}
	LUMIX_EXPECT(array1.size() == 10);

	for (int i = 0; i < 10; ++i)
	{
		LUMIX_EXPECT(array1[i] == i * 2);
	}

	array1.clear();
	LUMIX_EXPECT(array1.size() == 0);
	LUMIX_EXPECT(array1.empty());

	array1.resize(10);
	LUMIX_EXPECT(array1.size() == 10);

	array1.insert(0, 123);
	LUMIX_EXPECT(array1.size() == 11);
	LUMIX_EXPECT(array1[0] == 123);

	Lumix::Array<int> array2(allocator);
	array1.swap(array2);
	LUMIX_EXPECT(array2.size() == 11);
	LUMIX_EXPECT(array1.size() == 0);
}
Beispiel #2
0
int main(void){
	//Stack allocated array raw1 and its stack allocated Base objects.
	Base raw1[]={Base("one"),Base("two")};
	//Heap allocated array raw2 and its heap allocated Base objects
	Base* raw2=new Base[3];
	std::cout<<"3 dtor calls will follow shortly."<<std::endl;
	//forgetting to delete with [] operator will leak the all but raw2[0]
	delete [] raw2;

	std::cout<<"scoped_array init #1"<<std::endl;
	boost::scoped_array<Base> array1(new Base[2]);
	std::cout<<"scoped_array init #2"<<std::endl;
	Base *raw3=new Base[2];
	boost::scoped_array<Base> array2(raw3);

	std::cout<<"exiting main..."<<std::endl;
	return 0;
} 
        pilo::i32_t functional_test_construct(void* param)
        {
            M_UNUSED(param);

            fixed_array<testing_pod_info,13>      array;
            if (array.size() != 0)
            {
                return -1;
            }

            testing_pod_info  info[13];
            for (int i = 0; i < 13; i++)
            {
                info[i].m_id = i;
            }
            fixed_array<testing_pod_info, 13>      array1(info, 13, false);
            if (array1.size() != 13)
            {
                return -20;
            }
            for (int i = 0; i < (int) array1.size(); i++)
            {
                if (array1[i].m_id != i)
                {
                    return -1000 + i;
                }
            }
           
            fixed_array<testing_pod_info, 12>      array2(info, 13, true);
            if (array2.size() != 12)
            {
                return -30;
            }
            for (int i = 0; i < (int) array2.size(); i++)
            {
                if (array2[i].m_id != i)
                {
                    return -2000 + i;
                }
            }
          
            return 0;
        }
Beispiel #4
0
void
DynamicArrayTest::testCopyConstructor()
{
	Container array(4, 123);

	Container array2(array);

	TEST_ASSERT_FALSE(array2.isEmpty());
	TEST_ASSERT_EQUALS(array2.getSize(), 4U);

	for (uint_fast16_t i = 0; i < array2.getSize(); ++i) {
		TEST_ASSERT_EQUALS(array2[i], 123);
	}

	array[0] = 1;

	TEST_ASSERT_EQUALS(array[0], 1);
	TEST_ASSERT_EQUALS(array2[0], 123);
}
Beispiel #5
0
int main() {
	RLIdentRegister* iregister = new RLIdentRegister();
    RLType::setRegister(iregister);

    RLArray array1(RLType::Number);
    RLArray array2(RLType::Number);

    array1.setElem(1,&RLNumber(100));
    array1.setElem(2,&RLNumber(101));

    array2.applyBinary(assign,&array1);

    array1.getElem(1)->applyUnary(increment);

    array1.print();
    array2.print();

	delete iregister;
}
void
MSVehicleContainer::addReplacing(const VehicleDepartureVector& x) {
    if (isFull()) {
        std::vector<VehicleDepartureVector> array2((array.size() - 1) * 2 + 1, VehicleDepartureVector());
        for (int i = (int)array.size(); i-- > 0;) {
            assert(i < (int)array2.size());
            array2[i] = array[i];
        }
        array = array2;
    }

    // Percolate up
    int hole = ++currentSize;
    for (; hole > 1 && (x.first < array[ hole / 2 ].first); hole /= 2) {
        assert(array.size() > (size_t) hole);
        array[ hole ] = array[ hole / 2 ];
    }
    assert(array.size() > (size_t) hole);
    array[ hole ] = x;
}
Beispiel #7
0
void testTransactionManager() {
	printf("%s\n", "testTransactionManager");

	// Insert a document in wal
	BaseTransaction* wal = new BaseTransaction(_controller);
	wal->dropNamespace("db", "mtx");

	TransactionManager* manager = new TransactionManager(wal);

	BSONObj testA;
	testA.add("cod", 1);
	testA.add("name", "William");
	wal->insert("db", "mtx", &testA);

	std::string* t1 = uuid();

	StdTransaction* transaction = manager->getTransaction(*t1);
	std::auto_ptr<BSONArrayObj> array(transaction->find("db", "mtx", "*", "$'cod' == 1"));
	BSONObj* obj1up = array->get(0);
	obj1up->add("lastName", "Shakespeare");
	transaction->update("db", "mtx", obj1up);

	std::auto_ptr<BSONArrayObj> array0(wal->find("db", "mtx", "*", "$'cod' == 1"));
	BSONObj* origin1 = array0->get(0); 
	TEST_ASSERT(!origin1->has("lastName"));

	std::auto_ptr<BSONArrayObj> array1(transaction->find("db", "mtx", "*", "$'cod' == 1"));
	BSONObj* objtx1 = array1->get(0);
	TEST_ASSERT(objtx1->has("lastName"));

	transaction->commit();
	manager->dropTransaction(*t1);

	std::auto_ptr<BSONArrayObj> array2(wal->find("db", "mtx", "*", "$'cod' == 1"));
	BSONObj* origin2 = array2->get(0);
	TEST_ASSERT(origin2->has("lastName"));

	delete t1;
	delete manager;
	printf("%s\n", "~testTransactionManager");
}
Beispiel #8
0
void Json_Parser::write_a_array(cocos2d::ValueVector &temp,rapidjson::Value &val2,rapidjson::Document::AllocatorType&allocator){
     rapidjson::Value array2(rapidjson::kArrayType);
    for (int i=0; i<temp.size(); i++) {
        rapidjson::Value v;
        if(temp.at(i).getType()==Value::Type::DOUBLE){
            v.SetDouble(temp.at(i).asDouble());
            val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::STRING){
            v.SetString(temp.at(i).asString().c_str(),allocator);
            val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::BOOLEAN){
            v.SetBool(temp.at(i).asBool());
            val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::INTEGER){
            v.SetInt(temp.at(i).asInt());
           val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::NONE){
            v.SetNull();
           val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::MAP){
            ValueMap chmap=temp.at(i).asValueMap();
            v.SetObject();
                write_a_map(chmap,v,allocator);
             val2.PushBack(v,allocator);
        }
        else if(temp.at(i).getType()==Value::Type::VECTOR){
            
            ValueVector chvec=temp.at(i).asValueVector();
            v.SetArray();
                write_a_array(chvec, v, allocator);
            val2.PushBack(v, allocator);
        }

    }
    
}
Beispiel #9
0
FX_BOOL color::equal(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
	v8::Isolate* isolate = GetIsolate(cc);
	if (params.size() < 2) return FALSE;

	CJS_Array array1(isolate), array2(isolate);

	if (!params[0].ConvertToArray(array1)) return FALSE;
	if (!params[1].ConvertToArray(array2)) return FALSE;

	CPWL_Color color1;
	CPWL_Color color2;

	ConvertArrayToPWLColor(array1, color1);
	ConvertArrayToPWLColor(array2, color2);

	color1.ConvertColorType(color2.nColorType);

	vRet = color1 == color2;
	return TRUE;
}
Beispiel #10
0
void tst_QVectorArray::create4DArray()
{
    QVector4DArray array;
    QVERIFY(array.isEmpty());

    array.append(1.0f, 2.0f, 3.0f, 4.0f);
    array.append(3.0f, 4.0f, 5.0f, 6.0f);
    array.append(QVector4D(5.0f, 6.0f, 7.0f, 8.0f));

    QCOMPARE(array.size(), 3);
    QVERIFY(array[0] == QVector4D(1.0f, 2.0f, 3.0f, 4.0f));
    QVERIFY(array[1] == QVector4D(3.0f, 4.0f, 5.0f, 6.0f));
    QVERIFY(array[2] == QVector4D(5.0f, 6.0f, 7.0f, 8.0f));

    array.append(QVector4D(7.0f, 8.0f, 9.0f, 10.0f),
                 QVector4D(9.0f, 10.0f, 11.0f, 12.0f));
    array.append(QVector4D(11.0f, 12.0f, 13.0f, 14.0f),
                 QVector4D(13.0f, 14.0f, 15.0f, 16.0f),
                 QVector4D(15.0f, 16.0f, 17.0f, 18.0f));
    array.append(QVector4D(17.0f, 18.0f, 19.0f, 20.0f),
                 QVector4D(19.0f, 20.0f, 21.0f, 22.0f),
                 QVector4D(21.0f, 22.0f, 23.0f, 24.0f));

    for (int index = 0; index < array.size(); ++index) {
        QVERIFY(array[index] == QVector4D(index * 2 + 1,
                                          index * 2 + 2,
                                          index * 2 + 3,
                                          index * 2 + 4));
    }

    QVector4DArray array2(34);
    QCOMPARE(array2.size(), 34);
    for (int index = 0; index < array2.size(); ++index)
        QCOMPARE(array2[index], QVector4D(0.0f, 0.0f, 0.0f, 0.0f));

    QVector4DArray array3(15, QVector4D(1.0f, 2.0f, 3.0f, 4.0f));
    QCOMPARE(array3.size(), 15);
    for (int index = 0; index < array3.size(); ++index)
        QCOMPARE(array3[index], QVector4D(1.0f, 2.0f, 3.0f, 4.0f));
}
Beispiel #11
0
void tst_QVectorArray::create2DArray()
{
    QVector2DArray array;
    QVERIFY(array.isEmpty());

    array.append(1.0f, 2.0f);
    array.append(3.0f, 4.0f);
    array.append(QVector2D(5.0f, 6.0f));
    array.append(QPointF(7.0f, 8.0f));
    array.append(QPoint(9, 10));

    QCOMPARE(array.size(), 5);
    QVERIFY(array[0] == QVector2D(1.0f, 2.0f));
    QVERIFY(array[1] == QVector2D(3.0f, 4.0f));
    QVERIFY(array[2] == QVector2D(5.0f, 6.0f));
    QVERIFY(array[3] == QVector2D(7.0f, 8.0f));
    QVERIFY(array[4] == QVector2D(9.0f, 10.0f));

    array.append(QVector2D(11.0f, 12.0f), QVector2D(13.0f, 14.0f));
    array.append(QVector2D(15.0f, 16.0f), QVector2D(17.0f, 18.0f),
                 QVector2D(19.0f, 20.0f));
    array.append(QVector2D(21.0f, 22.0f), QVector2D(23.0f, 24.0f),
                 QVector2D(25.0f, 26.0f));

    for (int index = 0; index < array.size(); ++index)
        QVERIFY(array[index] == QVector2D(index * 2 + 1, index * 2 + 2));

    QVector2DArray array2(34);
    QCOMPARE(array2.size(), 34);
    for (int index = 0; index < array2.size(); ++index)
        QCOMPARE(array2[index], QVector2D(0.0f, 0.0f));

    QVector2DArray array3(15, QVector2D(1.0f, 2.0f));
    QCOMPARE(array3.size(), 15);
    for (int index = 0; index < array3.size(); ++index)
        QCOMPARE(array3[index], QVector2D(1.0f, 2.0f));
}
Beispiel #12
0
int main(int argc, char *argv[])
{
    srand (time(NULL));

	//kepek egyszeges meretenek beallitasa
    int size = 25;

	//a halo retegeinek es ezek mereteinek beallitasa
	std::vector<int> array2(2);
    array2[0] = size*size;
    array2[1] = 43;

	//az adatok betoltese
    DataSet d = DataSet();
    QString path = "../../TestLearning";
    d.LoadData(size,path);

    std::cout<< "Learning started" <<std::endl;
	//a halo letrehozasa
    Network net(array2);
	//tanulas megkezdese
    net.SGD(d,300,30,3,d);
    std::cout<< "Learning finished" <<std::endl;
}
DEF_TEST(SkSLMemoryLayout430Test, r) {
    SkSL::Context context;
    SkSL::MemoryLayout layout(SkSL::MemoryLayout::k430_Standard);

    // basic types
    REPORTER_ASSERT(r,  4 == layout.size(*context.fFloat_Type));
    REPORTER_ASSERT(r,  8 == layout.size(*context.fVec2_Type));
    REPORTER_ASSERT(r, 12 == layout.size(*context.fVec3_Type));
    REPORTER_ASSERT(r, 16 == layout.size(*context.fVec4_Type));
    REPORTER_ASSERT(r,  4 == layout.size(*context.fInt_Type));
    REPORTER_ASSERT(r,  8 == layout.size(*context.fIVec2_Type));
    REPORTER_ASSERT(r, 12 == layout.size(*context.fIVec3_Type));
    REPORTER_ASSERT(r, 16 == layout.size(*context.fIVec4_Type));
    REPORTER_ASSERT(r,  1 == layout.size(*context.fBool_Type));
    REPORTER_ASSERT(r,  2 == layout.size(*context.fBVec2_Type));
    REPORTER_ASSERT(r,  3 == layout.size(*context.fBVec3_Type));
    REPORTER_ASSERT(r,  4 == layout.size(*context.fBVec4_Type));
    REPORTER_ASSERT(r, 16 == layout.size(*context.fMat2x2_Type));
    REPORTER_ASSERT(r, 32 == layout.size(*context.fMat2x4_Type));
    REPORTER_ASSERT(r, 48 == layout.size(*context.fMat3x3_Type));
    REPORTER_ASSERT(r, 32 == layout.size(*context.fMat4x2_Type));
    REPORTER_ASSERT(r, 64 == layout.size(*context.fMat4x4_Type));
    REPORTER_ASSERT(r,  4 == layout.alignment(*context.fFloat_Type));
    REPORTER_ASSERT(r,  8 == layout.alignment(*context.fVec2_Type));
    REPORTER_ASSERT(r, 16 == layout.alignment(*context.fVec3_Type));
    REPORTER_ASSERT(r, 16 == layout.alignment(*context.fVec4_Type));
    REPORTER_ASSERT(r,  4 == layout.alignment(*context.fInt_Type));
    REPORTER_ASSERT(r,  8 == layout.alignment(*context.fIVec2_Type));
    REPORTER_ASSERT(r, 16 == layout.alignment(*context.fIVec3_Type));
    REPORTER_ASSERT(r, 16 == layout.alignment(*context.fIVec4_Type));
    REPORTER_ASSERT(r,  1 == layout.alignment(*context.fBool_Type));
    REPORTER_ASSERT(r,  2 == layout.alignment(*context.fBVec2_Type));
    REPORTER_ASSERT(r,  4 == layout.alignment(*context.fBVec3_Type));
    REPORTER_ASSERT(r,  4 == layout.alignment(*context.fBVec4_Type));
    REPORTER_ASSERT(r,  8 == layout.alignment(*context.fMat2x2_Type));
    REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat2x4_Type));
    REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat3x3_Type));
    REPORTER_ASSERT(r,  8 == layout.alignment(*context.fMat4x2_Type));
    REPORTER_ASSERT(r, 16 == layout.alignment(*context.fMat4x4_Type));

    // struct 1
    std::vector<SkSL::Type::Field> fields1;
    fields1.emplace_back(SkSL::Modifiers(), SkString("a"), context.fVec3_Type.get());
    SkSL::Type s1(SkSL::Position(), SkString("s1"), fields1);
    REPORTER_ASSERT(r, 16 == layout.size(s1));
    REPORTER_ASSERT(r, 16 == layout.alignment(s1));

    fields1.emplace_back(SkSL::Modifiers(), SkString("b"), context.fFloat_Type.get());
    SkSL::Type s2(SkSL::Position(), SkString("s2"), fields1);
    REPORTER_ASSERT(r, 16 == layout.size(s2));
    REPORTER_ASSERT(r, 16 == layout.alignment(s2));

    fields1.emplace_back(SkSL::Modifiers(), SkString("c"), context.fBool_Type.get());
    SkSL::Type s3(SkSL::Position(), SkString("s3"), fields1);
    REPORTER_ASSERT(r, 32 == layout.size(s3));
    REPORTER_ASSERT(r, 16 == layout.alignment(s3));

    // struct 2
    std::vector<SkSL::Type::Field> fields2;
    fields2.emplace_back(SkSL::Modifiers(), SkString("a"), context.fInt_Type.get());
    SkSL::Type s4(SkSL::Position(), SkString("s4"), fields2);
    REPORTER_ASSERT(r, 4 == layout.size(s4));
    REPORTER_ASSERT(r, 4 == layout.alignment(s4));

    fields2.emplace_back(SkSL::Modifiers(), SkString("b"), context.fVec3_Type.get());
    SkSL::Type s5(SkSL::Position(), SkString("s5"), fields2);
    REPORTER_ASSERT(r, 32 == layout.size(s5));
    REPORTER_ASSERT(r, 16 == layout.alignment(s5));

    // arrays
    SkSL::Type array1(SkString("float[4]"), SkSL::Type::kArray_Kind, *context.fFloat_Type, 4);
    REPORTER_ASSERT(r, 16 == layout.size(array1));
    REPORTER_ASSERT(r, 4 == layout.alignment(array1));
    REPORTER_ASSERT(r, 4 == layout.stride(array1));

    SkSL::Type array2(SkString("vec4[4]"), SkSL::Type::kArray_Kind, *context.fVec4_Type, 4);
    REPORTER_ASSERT(r, 64 == layout.size(array2));
    REPORTER_ASSERT(r, 16 == layout.alignment(array2));
    REPORTER_ASSERT(r, 16 == layout.stride(array2));
}
Beispiel #14
0
int
run_main (int, ACE_TCHAR *[])
{
  ACE_START_TEST (ACE_TEXT ("Collection_Test"));

  deletion_func NO_DFUNC = (deletion_func)0;
  DummyFunctor dummyfunc;

  {
    UNBOUNDED_SET unbounded_set;

    unbounded_set.insert (UglyThing ((void*)&unbounded_set, NO_DFUNC));
    unbounded_set.insert (UglyThing ((void*)&dummyfunc, NO_DFUNC));

    {
      for (UNBOUNDED_SET::iterator iterator = unbounded_set.begin ();
           iterator != unbounded_set.end ();
           ++iterator)
        {
          ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%x,%x\n"),
                      (*iterator).alloc_, (*iterator).dfunc_));
        }
    }

    unbounded_set.insert (UglyThing (0, NO_DFUNC));
    unbounded_set.remove (UglyThing ((void*)&dummyfunc, NO_DFUNC));

    {
      UNBOUNDED_SET_ITERATOR iterator (unbounded_set);
      while (!iterator.done ())
        {
          DATA *data = 0;
          iterator.next (data);
          ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%x,%x\n"),
                      data->alloc_, data->dfunc_));
          iterator.advance ();
        }
    }
    iterate_const (unbounded_set);

    unbounded_set.reset ();

    {
      DATA *data;
      UNBOUNDED_SET_ITERATOR i (unbounded_set);

      while (i.next (data) != 0)
        {
          ACE_DEBUG ((LM_DEBUG, "%x,%x\n", data->alloc_, data->dfunc_));
          i.advance ();
        }
    }
    iterate_const (unbounded_set);
  }

  {
    ARRAY array;
  }

  {
    ARRAY array (0);
  }

  {
    ARRAY array1;
    array1.size (2);
    array1[0] = 4;
    array1[1] = 4;

    ARRAY array2 (2, 4);

    ARRAY array3 (array2);

    ARRAY array4;
    array4 = array2;

    ACE_TEST_ASSERT (array1 == array2);
    ACE_TEST_ASSERT (array1 == array3);
    ACE_TEST_ASSERT (array1 == array4);

    {
      for (size_t i = 0;
           i != array1.size ();
           ++i)
        {
          ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d\n"),
                      array1[i]));
          ACE_TEST_ASSERT (array1[i] == 4);
        }
    }

    {
      ARRAY_ITERATOR iterator (array1);
      while (!iterator.done ())
        {
          ARRAY_DATA *data = 0;
          iterator.next (data);
          ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%d\n"),
                      (*data)));
          ACE_TEST_ASSERT (*data == 4);
          iterator.advance ();
        }
    }
  }


  ACE_END_TEST;

  return 0;
}
Beispiel #15
0
int main()
{
  Cimage array;
  Cimage darray[10];
  Cimage array2("test.img");
  int nDim1  = 1024;
  short int *piInt;
  int i;
  int nWhere[2];

  array.oHeader.nList();
  array2.oHeader.nList();

// Test nGetPixel, nPutPixel;
  (void) array2.nGetDimensions(&nWhere[0], &nWhere[1]);
  nWhere[0] = nWhere[0] / 2;
  nWhere[1] = nWhere[1] / 2;
  short int iPixel;
  (void) array2.nGetPixel(nWhere, &iPixel);
  cout << "Pixel at " << nWhere[0] << ", " << nWhere[1] << " is " 
       <<  iPixel << ".\n";
  
  iPixel = 9999;
  (void) array2.nSetPixel(nWhere, iPixel);
  (void) array2.nGetPixel(nWhere, &iPixel);
  cout << "Pixel at " << nWhere[0] << ", " << nWhere[1] << " is now " 
       <<  iPixel << ".\n\n";

  (void) array2.nSetNextPixel(nWhere);
  for (i=0; i < 10; i++)
      cout << "Next pixel is : " << array2.iGetNextPixel() << endl;

  cout << endl;
  (void) array2.nSetNextPixel(nWhere);
  for (i=0; i < 10; i++) array2.vSetNextPixel(iPixel);

  (void) array2.nSetNextPixel(nWhere);
  for (i=0; i < 10; i++)
    cout << "Next pixel is : " << array2.iGetNextPixel() << endl;


//  for (i=0; i< 10; i++) {
//    nDim1 = darray[i].nRead("test.img");
//    cout << "Status from darray[i].nRead: " << nDim1 << ".\n";
//  }

  nDim1 = array.nRead("test.img");
  cout << "Status from array.nRead: " << nDim1 << ".\n";
  array.oHeader.nList();

  cout << "Try a read without a file name!\n";
  nDim1 = array2.nRead();

  cout << "Status from array2.nRead: " << nDim1 << ".\n";

// Test Cimage::nList

  int nRect[4];// = {200, 300, 5, 10};   // fast, slow start; fast, slow extents
  do {
    cout << "Input center, widths of rectangle to list: ";
    cin >> nRect[0] >> nRect[1] >> nRect[2] >> nRect[3];
    array2.nList(nRect);
  } while (nRect[3] != 0);

// Test prfGetPixel

  (void) array2.nGetDimensions(&nWhere[0], &nWhere[1]);
  nWhere[0] = nWhere[0] / 2;
  nWhere[1] = nWhere[1] / 2;
  float fTemp = (array2.*array2.prfGetPixel)(nWhere[0]+i, nWhere[1]+i);
  for (i = 0; i < 10; i++)
    {
      cout << "Pixel at " << nWhere[0]+i << ", " << nWhere[1]+i << " is " 
       <<  (array2.*array2.prfGetPixel)(nWhere[0]+i, nWhere[1]+i) << ".\n\n";
    }
  
// Test Cimage::nGetRect, 3rd ctor and nWrite

  do {
    cout << "Input origin and extents of subimage to copy to new image: ";
    cin >> nRect[0] >> nRect[1] >> nRect[2] >> nRect[3];
//    short int *piShort = new (short int) [nRect[2]*nRect[3]];
    short *piShort = new short[nRect[2]*nRect[3]];
    nDim1 = array2.nGetRect(nRect, (char **)&piShort);

    if (nDim1 == 0) {
      Cimage *image1 = new Cimage(nRect[2], nRect[3], eImage_I2, piShort);
      cout << "\n\nListing of image1.oHeader\n";  image1->oHeader.nList();
      nDim1 = image1->nWrite();
      delete image1;
    }
    else
      cout << "Error in nGetRect\n";
    delete [] piShort;
  } while (nRect[3] != 0);

  {
    Cimage *image2 = new Cimage("test.img");
    cout << "\n\nListing of image2.oHeader\n";  image2->oHeader.nList();
    delete image2;
  }
  { 
    Cimage *image3 = new Cimage("");
    cout << "\n\nListing of image3.oHeader\n";  image3->oHeader.nList();
    delete image3;
  }
  array2.oHeader.nList();

  array.nWrite("writetest.img");
  delete piInt;

  short int* piData;
  piData = array.The_Data.pi;
  for (i = 0; i < array.nGetDimension(); i++)
    *piData++ = 100;
  array.nWrite();

  return 0;
}
    bool run ()
    {
      bool passed = true;

      /* create vector with random numbers */
      const size_t M = 10;
      std::vector<atomic<size_t>> flattened;
      typedef std::vector<std::vector<size_t>* > ArrayArray;
      ArrayArray array2(M);
      size_t K = 0;
      for (size_t i=0; i<M; i++) {
        const size_t N = rand() % 10;
        K += N;
        array2[i] = new std::vector<size_t>(N);
        for (size_t j=0; j<N; j++) 
          (*array2[i])[j] = rand() % 10;
      }
  
      /* array to test global index */
      std::vector<atomic<size_t>> verify_k(K);
      for (size_t i=0; i<K; i++) verify_k[i].store(0);

      ParallelForForPrefixSumState<size_t> state(array2,size_t(1));
  
      /* dry run only counts */
      size_t S = parallel_for_for_prefix_sum( state, array2, size_t(0), [&](std::vector<size_t>* v, const range<size_t>& r, size_t k, const size_t base) -> size_t
      {
        size_t s = 0;
	for (size_t i=r.begin(); i<r.end(); i++) {
          s += (*v)[i];
          verify_k[k++]++;
        }
        return s;
      }, [](size_t v0, size_t v1) { return v0+v1; });
      
      /* create properly sized output array */
      flattened.resize(S);
      memset(flattened.data(),0,sizeof(atomic<size_t>)*S);

      /* now we actually fill the flattened array */
      parallel_for_for_prefix_sum( state, array2, size_t(0), [&](std::vector<size_t>* v, const range<size_t>& r, size_t k, const size_t base) -> size_t
      {
        size_t s = 0;
	for (size_t i=r.begin(); i<r.end(); i++) {
          for (size_t j=0; j<(*v)[i]; j++) {
            flattened[base+s+j]++;
          }
          s += (*v)[i];
          verify_k[k++]++;
        }
        return s;
      }, [](size_t v0, size_t v1) { return v0+v1; });

      /* check global index */
      for (size_t i=0; i<K; i++) 
        passed &= (verify_k[i] == 2);

      /* check if each element was assigned exactly once */
      for (size_t i=0; i<flattened.size(); i++)
        passed &= (flattened[i] == 1);
      
      /* delete arrays again */
      for (size_t i=0; i<array2.size(); i++)
	delete array2[i];

      return passed;
    }
Beispiel #17
0
//==============================================================================
int checkSharedOwnership(Epetra_Comm& Comm, bool verbose) {
	// check to make sure each function returns 1 when it should
	// check to make sure each function doesn't return 1 when it shouldn't
	int ierr = 0;

	// initialize Map
	const int NumMyElements = 10;
	const long long IndexBase = 0;
	Epetra_Map Map1((long long) -1, NumMyElements, IndexBase, Comm);
	// initialize Graphs
	const int NumIndicesPerRow = 5;
	Epetra_CrsGraph SoleOwner(Copy, Map1, Map1, NumIndicesPerRow);
	Epetra_CrsGraph SharedOrig(Copy, Map1, Map1, NumIndicesPerRow);
	Epetra_CrsGraph SharedOwner(SharedOrig);
	// arrays used by Insert & Remove
	Epetra_IntSerialDenseVector array1(2);
	array1[0] = NumIndicesPerRow / 2;
	array1[1] = array1[0] + 1;
	Epetra_LongLongSerialDenseVector array2(NumIndicesPerRow);
	for(int i = 0; i < NumIndicesPerRow; i++)
		array2[i] = i;
	// output variables (declaring them here lets us comment out indiv. tests)
	int soleOutput, sharedOutput;

	// InsertMyIndices
	if(verbose) cout << "InsertMyIndices..." << endl;
	soleOutput = SoleOwner.InsertMyIndices(0, 2, array1.Values());
	sharedOutput = SharedOwner.InsertMyIndices(0, 2, array1.Values());
	EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
	EPETRA_TEST_ERR(!(sharedOutput == 1), ierr);
	if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;

	// SortIndices
	//if(verbose) cout << "SortIndices..." << endl;
	//soleOutput = SoleOwner.SortIndices();
	//sharedOutput = SharedOwner.SortIndices();
	//EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
	//EPETRA_TEST_ERR(!(sharedOutput == 1), ierr);
	//if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;

	// RemoveRedundantIndices
	//if(verbose) cout << "RemoveRedundantIndices..." << endl;
	//SoleOwner.InsertGlobalIndices(0, 1, array1.Values());
	//SharedOwner.InsertGlobalIndices(0, 1, array1.Values());
	//soleOutput = SoleOwner.RemoveRedundantIndices();
	//sharedOutput = SharedOwner.RemoveRedundantIndices();
	//EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
	//EPETRA_TEST_ERR(!(sharedOutput == 1), ierr);
	//if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;

	// FillComplete (#1)
	if(verbose) cout << "FillComplete..." << endl;
	soleOutput = SoleOwner.FillComplete();
	sharedOutput = SharedOwner.FillComplete();
	EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
	EPETRA_TEST_ERR(!(sharedOutput == 1), ierr);
	if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;

	// OptimizeStorage
	if(verbose) cout << "OptimizeStorage..." << endl;
	soleOutput = SoleOwner.OptimizeStorage();
	sharedOutput = SharedOwner.OptimizeStorage();
	EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
	EPETRA_TEST_ERR(!(sharedOutput == 0), ierr);
	if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;

	// RemoveMyIndices (#1)
	if(verbose) cout << "RemoveMyIndices..." << endl;
	soleOutput = SoleOwner.RemoveMyIndices(0, 1, &array1[1]);
	sharedOutput = SharedOwner.RemoveMyIndices(0, 1, &array1[1]);
	EPETRA_TEST_ERR(!(soleOutput == -1), ierr);
	EPETRA_TEST_ERR(!(sharedOutput == -1), ierr);
	if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;

	// RemoveMyIndices (#2)
	if(verbose) cout << "RemoveMyIndices(#2)..." << endl;
	soleOutput = SoleOwner.RemoveMyIndices(0);
	sharedOutput = SharedOwner.RemoveMyIndices(0);
	EPETRA_TEST_ERR(!(soleOutput == -1), ierr);
	EPETRA_TEST_ERR(!(sharedOutput == -1), ierr);
	if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;

	// FillComplete (#2)
	if(verbose) cout << "FillComplete(#2)..." << endl;
	soleOutput = SoleOwner.FillComplete(SoleOwner.DomainMap(), SoleOwner.RangeMap());
	sharedOutput = SharedOwner.FillComplete(SharedOwner.DomainMap(), SharedOwner.RangeMap());
	EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
	EPETRA_TEST_ERR(!(sharedOutput == 1), ierr);
	if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;

	{
		// make new Graphs so that we can insert Global instead of Local
		// inside of new scope so that we can use same names
		Epetra_CrsGraph SoleOwnerG(Copy, Map1, NumIndicesPerRow);
		Epetra_CrsGraph SharedOrigG(Copy, Map1, NumIndicesPerRow);
		Epetra_CrsGraph SharedOwnerG(SharedOrig);
		
		long long GlobalRow = SoleOwnerG.GRID64(0);

		// InsertGlobalIndices
		if(verbose) cout << "InsertGlobalIndices..." << endl;
		soleOutput = SoleOwnerG.InsertGlobalIndices(GlobalRow, 2, array2.Values());
		sharedOutput = SharedOwnerG.InsertGlobalIndices(GlobalRow, 2, array2.Values());
		EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
		EPETRA_TEST_ERR(!(sharedOutput == 1), ierr);
		if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;
		
		// RemoveGlobalIndices (#1)
		if(verbose) cout << "RemoveGlobalIndices..." << endl;
		soleOutput = SoleOwnerG.RemoveGlobalIndices(GlobalRow, 1, &array2[1]);
		sharedOutput = SharedOwnerG.RemoveGlobalIndices(GlobalRow, 1, &array2[1]);
		EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
		EPETRA_TEST_ERR(!(sharedOutput == 1), ierr);
		if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;
		
		// RemoveGlobalIndices (#2)
		if(verbose) cout << "RemoveGlobalIndices(#2)..." << endl;
		soleOutput = SoleOwnerG.RemoveGlobalIndices(GlobalRow);
		sharedOutput = SharedOwnerG.RemoveGlobalIndices(GlobalRow);
		EPETRA_TEST_ERR(!(soleOutput == 0), ierr);
		EPETRA_TEST_ERR(!(sharedOutput == 1), ierr);
		if(verbose && ierr > 0) cout << "soleOutput = " << soleOutput << " sharedOutput = " << sharedOutput << endl;
		}


	// *PROT* InsertIndices
	// *PROT* MakeIndicesLocal

	return(ierr);

}
	void UnitTestDynamicArray::DoTest()
	{
		UNIT_TEST_BLOCK_START();

			Dia::Core::Containers::DynamicArray<int> array(3);
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array.At(0) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

			UNIT_TEST_POSITIVE(array.Capacity() == 3, "DynamicArray()");
			UNIT_TEST_POSITIVE(array.Size() == 0, "DynamicArray()");

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();

			int cArray1[3] = {1, 2, 3};

			UNIT_TEST_ASSERT_EXPECTED_START();
			int* ptr = NULL;
			Dia::Core::Containers::DynamicArray<int> array0(ptr, 3);
			UNIT_TEST_ASSERT_EXPECTED_END();			
			
			Dia::Core::Containers::DynamicArray<int> array1(&cArray1[0], 3);
				
			UNIT_TEST_POSITIVE(array1.Capacity() == 3, "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.IsFull(), "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray(ConstPointer pData, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray(ConstPointer pData, unsigned int _size)");

			int cArray2[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> array2(&cArray2[0], 3);
			
			UNIT_TEST_POSITIVE(array2.Capacity() == 3, "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array2.IsFull(), "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array2.Size() == 3, "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array2.At(0) == 1, "DynamicArray(ConstPointer pData, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array2.At(1) == 2, "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array2.At(2) == 3, "DynamicArray(ConstPointer pData, unsigned int _size)");

			int cArray3[2] = {1, 2};
			Dia::Core::Containers::DynamicArray<int> array3(&cArray3[0], 2);
				
			UNIT_TEST_POSITIVE(array3.Capacity() == 2, "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.IsFull(), "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.Size() == 2, "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.At(0) == 1, "DynamicArray(ConstPointer pData, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array3.At(1) == 2, "DynamicArray(ConstPointer pData, unsigned int _size)");
		
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array3.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();

			int cArray1[3] = {1, 2, 3};
			
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 3);
			Dia::Core::Containers::DynamicArray<int> array1(tempArray1);
		
			UNIT_TEST_POSITIVE(array1.IsFull(), "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.Capacity() == 3, "DynamicArray(ConstPointer pData, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray(ConstReference data, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray(ConstReference data, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray(ConstReference data, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray(ConstReference data, unsigned int _size)");

			int cArray3[2] = {1, 2};
			Dia::Core::Containers::DynamicArray<int> tempArray3(cArray3, 2);
			Dia::Core::Containers::DynamicArray<int> array3(tempArray3);

			UNIT_TEST_POSITIVE(array3.IsFull(), "DynamicArray(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.Capacity() == 2, "DynamicArray(ConstPointer pData, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array3.Size() == 2, "DynamicArray(ConstReference data, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.At(0) == 1, "DynamicArray(ConstReference data, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array3.At(1) == 2, "DynamicArray(ConstReference data, unsigned int _size)");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array3.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();

			int cArray1[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 5);
			Dia::Core::Containers::DynamicArray<int> array1(tempArray1);

			UNIT_TEST_POSITIVE(array1.IsFull(), "DynamicArray(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.Capacity() == 5, "DynamicArray(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.Size() == 5, "DynamicArray(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray(const DynamicArray<T,_size>& rhs)");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.At(3) == 4, "DynamicArray(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.At(4) == 5, "DynamicArray(const DynamicArray<T,_size>& rhs)");

		UNIT_TEST_BLOCK_END();


		UNIT_TEST_BLOCK_START();

			int cArray[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray(cArray, 5);

			UNIT_TEST_ASSERT_EXPECTED_START();
			Dia::Core::Containers::DynamicArray<int> array1(tempArray, 2, 0);
			UNIT_TEST_ASSERT_EXPECTED_END();	
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			Dia::Core::Containers::DynamicArray<int> array1(tempArray, 5, 2);
			UNIT_TEST_ASSERT_EXPECTED_END();	

			int cArray1[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 5);
			Dia::Core::Containers::DynamicArray<int> array1(tempArray1, 1, 3);

			UNIT_TEST_POSITIVE(array1.IsFull(), "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements");
			UNIT_TEST_POSITIVE(array1.Capacity() == 3, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			UNIT_TEST_POSITIVE(array1.At(0) == 2, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");	
			UNIT_TEST_POSITIVE(array1.At(1) == 3, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			UNIT_TEST_POSITIVE(array1.At(2) == 4, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");

			int cArray2[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray2(cArray2, 5);
			Dia::Core::Containers::DynamicArray<int> array2(tempArray2, 1, 2);

			UNIT_TEST_POSITIVE(array2.IsFull(), "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements");
			UNIT_TEST_POSITIVE(array2.Capacity() == 2, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			UNIT_TEST_POSITIVE(array2.Size() == 2, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			UNIT_TEST_POSITIVE(array2.At(0) == 2, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");	
			UNIT_TEST_POSITIVE(array2.At(1) == 3, "DynamicArray(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array2.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();
		
			int cArray1[3] = {1, 2, 3};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 3);

			Dia::Core::Containers::DynamicArray<int>::ConstIterator iter1(tempArray1.Begin());
			Dia::Core::Containers::DynamicArray<int> array1(3, iter1);

			UNIT_TEST_POSITIVE(array1.IsFull(), "DynamicArray(Iterator begin)");
			UNIT_TEST_POSITIVE(array1.Capacity() == 3, "DynamicArray(Iterator begin)");
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray<T, size>::DynamicArray ( Iterator begin )");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray<T, size>::DynamicArray ( Iterator begin )");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray<T, size>::DynamicArray ( Iterator begin )");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray<T, size>::DynamicArray ( Iterator begin )");

			int cArray2[2] = {1, 2};
			Dia::Core::Containers::DynamicArray<int> tempArray2(cArray2, 2);
			Dia::Core::Containers::DynamicArray<int> array2(3, tempArray2.BeginConst());

			UNIT_TEST_POSITIVE(!array2.IsFull(), "DynamicArray(Iterator begin)");
			UNIT_TEST_POSITIVE(array2.Capacity() == 3, "DynamicArray(Iterator begin)");
			UNIT_TEST_POSITIVE(array2.Size() == 2, "DynamicArray<T, size>::DynamicArray ( Iterator begin )");
			UNIT_TEST_POSITIVE(array2.At(0) == 1, "DynamicArray<T, size>::DynamicArray ( Iterator begin )");	
			UNIT_TEST_POSITIVE(array2.At(1) == 2, "DynamicArray<T, size>::DynamicArray ( Iterator begin )");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array2.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();
		
			int cArray1[3] = {1, 2, 3};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 3);

			Dia::Core::Containers::DynamicArray<int> array1(3, tempArray1.EndConst());

			UNIT_TEST_POSITIVE(array1.IsFull(), "DynamicArray(ConstReverseIterator begin)");
			UNIT_TEST_POSITIVE(array1.Capacity() == 3, "DynamicArray(ConstReverseIterator begin)");
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray<T, size>::DynamicArray ( ConstReverseIterator iter begin )");
			UNIT_TEST_POSITIVE(array1.At(0) == 3, "DynamicArray<T, size>::DynamicArray ( ConstReverseIterator iter begin )");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray<T, size>::DynamicArray ( ConstReverseIterator iter begin )");
			UNIT_TEST_POSITIVE(array1.At(2) == 1, "DynamicArray<T, size>::DynamicArray ( ConstReverseIterator iter begin )");

			int cArray2[2] = {1, 2};
			Dia::Core::Containers::DynamicArray<int> tempArray2(cArray2, 2);
			Dia::Core::Containers::DynamicArray<int> array2(3, tempArray2.EndConst());

			UNIT_TEST_POSITIVE(!array2.IsFull(), "DynamicArray(ConstReverseIterator begin)");
			UNIT_TEST_POSITIVE(array2.Capacity() == 3, "DynamicArray(ConstReverseIterator begin)");
			UNIT_TEST_POSITIVE(array2.Size() == 2, "DynamicArray<T, size>::DynamicArray ( ConstReverseIterator iter begin )");
			UNIT_TEST_POSITIVE(array2.At(0) == 2, "DynamicArray<T, size>::DynamicArray ( ConstReverseIterator iter begin )");	
			UNIT_TEST_POSITIVE(array2.At(1) == 1, "DynamicArray<T, size>::DynamicArray ( ConstReverseIterator iter begin )");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array2.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();
		
			class AboveTwoFilter
			{
			public:
				bool Evaluate(const int& currentIter)const
				{
					return (currentIter > 2);
				};
			};

			AboveTwoFilter filter1;

			int cArray1[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 5);

			Dia::Core::Containers::DynamicArray<int> array1(5, tempArray1.BeginConst(), filter1);

			UNIT_TEST_POSITIVE(!array1.IsFull(), "DynamicArray(ConstIterator& iter, const EvaluateFunctor& filter)");
			UNIT_TEST_POSITIVE(array1.Capacity() == 5, "DynamicArray(ConstIterator& iter, const EvaluateFunctor& filter)");
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray<T, size>::DynamicArray ( ConstIterator& iter, const EvaluateFunctor& filter )");
			UNIT_TEST_POSITIVE(array1.At(0) == 3, "DynamicArray<T, size>::DynamicArray ( ConstIterator& iter, const EvaluateFunctor<T, bool>* filter )");	
			UNIT_TEST_POSITIVE(array1.At(1) == 4, "DynamicArray<T, size>::DynamicArray ( ConstIterator& iter, const EvaluateFunctor<T, bool>* filter )");
			UNIT_TEST_POSITIVE(array1.At(2) == 5, "DynamicArray<T, size>::DynamicArray ( ConstIterator& iter, const EvaluateFunctor<T, bool>* filter )");
		
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array1.At(3) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array1.At(4) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();

			int cArray1[3] = {1, 2, 3};

			UNIT_TEST_ASSERT_EXPECTED_START();
			int* ptr = NULL;
			Dia::Core::Containers::DynamicArray<int> array0(3);
			array0.Assign(ptr, 3);
			UNIT_TEST_ASSERT_EXPECTED_END();			
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(&cArray1[0], 10);
			UNIT_TEST_ASSERT_EXPECTED_END();

			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(&cArray1[0], 3);
				
			UNIT_TEST_POSITIVE(array1.IsFull(), "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.Capacity() == 3, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");

			int cArray2[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> array2(3);
			array2.Assign(&cArray2[0], 3);
				
			UNIT_TEST_POSITIVE(array2.IsFull(), "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array2.Capacity() == 3, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array2.Size() == 3, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array2.At(0) == 1, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array2.At(1) == 2, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array2.At(2) == 3, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");

			int cArray3[2] = {1, 2};
			Dia::Core::Containers::DynamicArray<int> array3(3);
			array3.Assign(&cArray3[0], 2);
				
			UNIT_TEST_POSITIVE(!array3.IsFull(), "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.Capacity() == 3, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.Size() == 2, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.At(0) == 1, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array3.At(1) == 2, "DynamicArray.Assign(ConstPointer pData, unsigned int _size)");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array3.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();
		
		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();

			int cArray1[3] = {1, 2, 3};
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(cArray1, 10);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			Dia::Core::Containers::DynamicArray<int> tempArray1;
			tempArray1.Reserve(3);
			tempArray1.Assign(cArray1, 3);
			Dia::Core::Containers::DynamicArray<int> array1(tempArray1);
		
			UNIT_TEST_POSITIVE(array1.IsFull(), "DynamicArray.Assign(ConstReference pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.Capacity() == 3, "DynamicArray.Assign(ConstReference pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray.Assign(ConstReference data, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray.Assign(ConstReference data, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray.Assign(ConstReference data, unsigned int _size)");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray.Assign(ConstReference data, unsigned int _size)");

			int cArray3[2] = {1, 2};
			Dia::Core::Containers::DynamicArray<int> tempArray3;
 			tempArray3.Reserve(3);
 			tempArray3.Assign(cArray3, 2);
 			Dia::Core::Containers::DynamicArray<int> array3(tempArray3);

			UNIT_TEST_POSITIVE(!array3.IsFull(), "DynamicArray.Assign(ConstReference pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.Capacity() == 3, "DynamicArray.Assign(ConstReference pData, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.Size() == 2, "DynamicArray.Assign(ConstReference data, unsigned int _size)");
			UNIT_TEST_POSITIVE(array3.At(0) == 1, "DynamicArray.Assign(ConstReference data, unsigned int _size)");	
			UNIT_TEST_POSITIVE(array3.At(1) == 2, "DynamicArray.Assign(ConstReference data, unsigned int _size)");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array3.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();

			int cArray1[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 5);
			Dia::Core::Containers::DynamicArray<int> array1;
			array1.Reserve(5);
			array1.Assign(tempArray1);

			UNIT_TEST_POSITIVE(array1.Size() == 5, "DynamicArray(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs)");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.At(3) == 4, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array1.At(4) == 5, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs)");

			int cArray2[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray2(cArray2, 5);
			Dia::Core::Containers::DynamicArray<int> array2(3);
			array2.Assign(tempArray2);

			UNIT_TEST_POSITIVE(array2.Size() == 3, "DynamicArray(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array2.At(0) == 1, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs)");	
			UNIT_TEST_POSITIVE(array2.At(1) == 2, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs)");
			UNIT_TEST_POSITIVE(array2.At(2) == 3, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs)");

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();

			int cArray[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray(cArray, 5);

			UNIT_TEST_ASSERT_EXPECTED_START();
			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(tempArray, 2, 0);
			UNIT_TEST_ASSERT_EXPECTED_END();	
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(tempArray, 5, 2);
			UNIT_TEST_ASSERT_EXPECTED_END();	
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(tempArray, 2, 10);
			UNIT_TEST_ASSERT_EXPECTED_END();

			int cArray1[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 5);
			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(tempArray1, 1, 3);

			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			UNIT_TEST_POSITIVE(array1.At(0) == 2, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");	
			UNIT_TEST_POSITIVE(array1.At(1) == 3, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			UNIT_TEST_POSITIVE(array1.At(2) == 4, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");

			int cArray2[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray2(cArray2, 5);
			Dia::Core::Containers::DynamicArray<int> array2(3);
			array2.Assign(tempArray2, 1, 2);

			UNIT_TEST_POSITIVE(array2.Size() == 2, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			UNIT_TEST_POSITIVE(array2.At(0) == 2, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");	
			UNIT_TEST_POSITIVE(array2.At(1) == 3, "DynamicArray.Assign(const DynamicArray<T,_size>& rhs, unsigned int startIndex, unsigned int numberElements)");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array2.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();
		
			int cArray1[3] = {1, 2, 3};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 3);

			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(tempArray1.BeginConst());

			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray<T, size>::DynamicArray.Assign ( Iterator begin )");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray<T, size>::DynamicArray.Assign ( Iterator begin )");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray<T, size>::DynamicArray.Assign ( Iterator begin )");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray<T, size>::DynamicArray.Assign ( Iterator begin )");

			int cArray2[2] = {1, 2};
			Dia::Core::Containers::DynamicArray<int> tempArray2(cArray2, 2);
			Dia::Core::Containers::DynamicArray<int> array2(3);
			array2.Assign(tempArray2.BeginConst());

			UNIT_TEST_POSITIVE(array2.Size() == 2, "DynamicArray<T, size>::DynamicArray.Assign ( Iterator begin )");
			UNIT_TEST_POSITIVE(array2.At(0) == 1, "DynamicArray<T, size>::DynamicArray.Assign ( Iterator begin )");	
			UNIT_TEST_POSITIVE(array2.At(1) == 2, "DynamicArray<T, size>::DynamicArray.Assign ( Iterator begin )");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array2.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();
		
			int cArray1[3] = {1, 2, 3};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 3);

			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Assign(tempArray1.EndConst());

			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray<T, size>::DynamicArray.Assign ( ConstReverseIterator iter begin )");
			UNIT_TEST_POSITIVE(array1.At(0) == 3, "DynamicArray<T, size>::DynamicArray.Assign ( ConstReverseIterator iter begin )");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray<T, size>::DynamicArray.Assign ( ConstReverseIterator iter begin )");
			UNIT_TEST_POSITIVE(array1.At(2) == 1, "DynamicArray<T, size>::DynamicArray.Assign ( ConstReverseIterator iter begin )");

			int cArray2[2] = {1, 2};
			Dia::Core::Containers::DynamicArray<int> tempArray2(cArray2, 2);
			Dia::Core::Containers::DynamicArray<int> array2(3);
			array2.Assign(tempArray2.EndConst());

			UNIT_TEST_POSITIVE(array2.Size() == 2, "DynamicArray<T, size>::DynamicArray.Assign ( ConstReverseIterator iter begin )");
			UNIT_TEST_POSITIVE(array2.At(0) == 2, "DynamicArray<T, size>::DynamicArray.Assign ( ConstReverseIterator iter begin )");	
			UNIT_TEST_POSITIVE(array2.At(1) == 1, "DynamicArray<T, size>::DynamicArray.Assign ( ConstReverseIterator iter begin )");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array2.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();
		
			class AboveTwoFilter
			{
			public:
				bool Evaluate(const int& currentIter)const
				{
					return (currentIter > 2);
				};
			};

			AboveTwoFilter filter1;

			int cArray1[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 5);

			Dia::Core::Containers::DynamicArray<int> array1(5);
			array1.Assign(tempArray1.BeginConst(), filter1);

			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray<T, size>::DynamicArray.Assign ( ConstIterator& iter, const EvaluateFunctor<T, bool>* filter )");
			UNIT_TEST_POSITIVE(array1.At(0) == 3, "DynamicArray<T, size>::DynamicArray.Assign ( ConstIterator& iter, const EvaluateFunctor<T, bool>* filter )");	
			UNIT_TEST_POSITIVE(array1.At(1) == 4, "DynamicArray<T, size>::DynamicArray.Assign ( ConstIterator& iter, const EvaluateFunctor<T, bool>* filter )");
			UNIT_TEST_POSITIVE(array1.At(2) == 5, "DynamicArray<T, size>::DynamicArray.Assign ( ConstIterator& iter, const EvaluateFunctor<T, bool>* filter )");
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array1.At(3) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array1.At(4) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();

			int cArray1[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray1(cArray1, 5);
			Dia::Core::Containers::DynamicArray<int> array1(5);
			array1 = tempArray1;

			UNIT_TEST_POSITIVE(array1.Size() == 5, "DynamicArray opertor=");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray opertor=");	
			UNIT_TEST_POSITIVE(array1.At(1) == 2, "DynamicArray opertor=");
			UNIT_TEST_POSITIVE(array1.At(2) == 3, "DynamicArray opertor=");
			UNIT_TEST_POSITIVE(array1.At(3) == 4, "DynamicArray opertor=");
			UNIT_TEST_POSITIVE(array1.At(4) == 5, "DynamicArray opertor=");

			int cArray2[5] = {1, 2, 3, 4, 5};
			Dia::Core::Containers::DynamicArray<int> tempArray2(cArray2, 5);
			Dia::Core::Containers::DynamicArray<int> array2(3);
			array2 = tempArray2;

			UNIT_TEST_POSITIVE(array2.Size() == 3, "DynamicArray opertor=");
			UNIT_TEST_POSITIVE(array2.At(0) == 1, "DynamicArray opertor=");	
			UNIT_TEST_POSITIVE(array2.At(1) == 2, "DynamicArray opertor=");
			UNIT_TEST_POSITIVE(array2.At(2) == 3, "DynamicArray opertor=");

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();

			int cArray1[5] = {1, 2, 3, 4, 5};
			
			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 5);
			Dia::Core::Containers::DynamicArray<int> array2(array1);
			Dia::Core::Containers::DynamicArray<int> array3(array1, 1, 3);

			UNIT_TEST_POSITIVE(array1 == array2, "DynamicArray opertor==");
			UNIT_TEST_NEGATIVE(array1 == array3, "DynamicArray opertor==");	
			UNIT_TEST_POSITIVE(array1 != array3, "DynamicArray opertor!=");
			UNIT_TEST_NEGATIVE(array1 != array2, "DynamicArray opertor!=");

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();

			int cArray1[5] = {1, 2, 3, 4, 5};
			
			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 5);
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			int temp = array1[-1];
			UNIT_TEST_ASSERT_EXPECTED_END();	
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			int temp = array1[6];
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			int temp = array1.At(-1);
			UNIT_TEST_ASSERT_EXPECTED_END();	
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			int temp = array1.At(6);
			UNIT_TEST_ASSERT_EXPECTED_END();

			UNIT_TEST_POSITIVE(array1[0] == array1.At(0), "DynamicArray opertor[]");
			UNIT_TEST_POSITIVE(array1[1] == array1.At(1), "DynamicArray opertor[]");
			UNIT_TEST_POSITIVE(array1[2] == array1.At(2), "DynamicArray opertor[]");
			UNIT_TEST_POSITIVE(array1[3] == array1.At(3), "DynamicArray opertor[]");
			UNIT_TEST_POSITIVE(array1[4] == array1.At(4), "DynamicArray opertor[]");
			
			UNIT_TEST_POSITIVE(array1.Front() == array1.At(0), "DynamicArray Front");
			UNIT_TEST_POSITIVE(array1.Back() == array1.At(4), "DynamicArray Back");
		
		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();

			int cArray1[5] = {1, 2, 3, 4, 5};
			
			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 5);
			
			UNIT_TEST_POSITIVE(&array1[0] == array1.IteratorAt(0).Current(), "DynamicArray IteratorAt");
			UNIT_TEST_POSITIVE(&array1[1] == array1.IteratorAt(1).Current(), "DynamicArray IteratorAt");
			UNIT_TEST_POSITIVE(&array1[2] == array1.IteratorAt(2).Current(), "DynamicArray IteratorAt");
			UNIT_TEST_POSITIVE(&array1[3] == array1.IteratorAt(3).Current(), "DynamicArray IteratorAt");
			UNIT_TEST_POSITIVE(&array1[4] == array1.IteratorAt(4).Current(), "DynamicArray IteratorAt");
			
			UNIT_TEST_POSITIVE(array1.Begin() == array1.IteratorAt(0), "DynamicArray Begin");
			UNIT_TEST_POSITIVE(array1.BeginConst() == array1.IteratorAtConst(0), "DynamicArray BeginConst");

			UNIT_TEST_POSITIVE(&array1[0] == array1.ReverseIteratorAt(0).Current(), "DynamicArray ReverseIteratorAt");
			UNIT_TEST_POSITIVE(&array1[1] == array1.ReverseIteratorAt(1).Current(), "DynamicArray ReverseIteratorAt");
			UNIT_TEST_POSITIVE(&array1[2] == array1.ReverseIteratorAt(2).Current(), "DynamicArray ReverseIteratorAt");
			UNIT_TEST_POSITIVE(&array1[3] == array1.ReverseIteratorAt(3).Current(), "DynamicArray ReverseIteratorAt");
			UNIT_TEST_POSITIVE(&array1[4] == array1.ReverseIteratorAt(4).Current(), "DynamicArray ReverseIteratorAt");
			
			UNIT_TEST_POSITIVE(array1.End() == array1.ReverseIteratorAt(4), "DynamicArray End");
			UNIT_TEST_POSITIVE(array1.EndConst() == array1.ReverseIteratorAtConst(4), "DynamicArray EndConst");
		
		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();

			int cArray1[10] = {1, 2, 3, 4, 5, 1, 3, 3, 3, 4};
			
			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 10);
			
			UNIT_TEST_POSITIVE(array1.FrequencyOfElement(1) == 2, "DynamicArray FrequencyOfElement");
			UNIT_TEST_POSITIVE(array1.FrequencyOfElement(2) == 1, "DynamicArray FrequencyOfElement");
			UNIT_TEST_POSITIVE(array1.FrequencyOfElement(3) == 4, "DynamicArray FrequencyOfElement");
			UNIT_TEST_POSITIVE(array1.FrequencyOfElement(4) == 2, "DynamicArray FrequencyOfElement");
			UNIT_TEST_POSITIVE(array1.FrequencyOfElement(5) == 1, "DynamicArray FrequencyOfElement");
			UNIT_TEST_POSITIVE(array1.FrequencyOfElement(6) == 0, "DynamicArray FrequencyOfElement");
			
			Dia::Core::Containers::DynamicArray<int> arrayUnique(10);
			array1.UniqueElements(arrayUnique);

			UNIT_TEST_POSITIVE(arrayUnique.Size() == 5, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayUnique[0] == 1, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayUnique[1] == 2, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayUnique[2] == 3, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayUnique[3] == 4, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayUnique[4] == 5, "DynamicArray numberOfUniqueElements");
			
			Dia::Core::Containers::DynamicArray<int> arrayFreqUnique(10);
			Dia::Core::Containers::DynamicArray<int> arrayFreq(10);
			array1.FrequencyUniqueElements(arrayFreqUnique, arrayFreq);

			UNIT_TEST_POSITIVE(arrayFreqUnique.Size() == 5, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreqUnique[0] == 1, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreqUnique[1] == 2, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreqUnique[2] == 3, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreqUnique[3] == 4, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreqUnique[4] == 5, "DynamicArray numberOfUniqueElements");

			UNIT_TEST_POSITIVE(arrayFreq[0] == 2, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreq[1] == 1, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreq[2] == 4, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreq[3] == 2, "DynamicArray numberOfUniqueElements");
			UNIT_TEST_POSITIVE(arrayFreq[4] == 1, "DynamicArray numberOfUniqueElements");
		
		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();
			
			class IncreasingOrder
			{
			public:
				bool GreaterThen(const int& object1, const int& object2)const
				{
					return (object1 > object2);
				}

				bool LessThen(const int& object1, const int& object2)const
				{
					return (object1 < object2);
				}

				bool Equal(const int& object1, const int& object2)const
				{
					return (object1 == object2);
				}
			};

			IncreasingOrder order;

			int cArray1[10] = {1, 2, 3, 4, 5, 1, 3, 3, 3, 4};
			int cArray2[5] = {4, 2, 5, 1, 3};

			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 10);
			Dia::Core::Containers::DynamicArray<int> array2(cArray2, 5);
			
			Dia::Core::Containers::DynamicArray<int> array3(cArray1, 10);
			Dia::Core::Containers::DynamicArray<int> array4(cArray2, 5);

			array1.Sort(order);
			
			UNIT_TEST_POSITIVE(array1[0] == 1, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[1] == 1, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[2] == 2, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[3] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[4] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[5] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[6] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[7] == 4, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[8] == 4, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1[9] == 5, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array1.IsSorted(order), "DynamicArray Sort");

			array2.Sort(order);
			
			UNIT_TEST_POSITIVE(array2[0] == 1, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array2[1] == 2, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array2[2] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array2[3] == 4, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array2[4] == 5, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array2.IsSorted(order), "DynamicArray Sort");
				
			array3.Sort();

			UNIT_TEST_POSITIVE(array3[0] == 1, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[1] == 1, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[2] == 2, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[3] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[4] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[5] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[6] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[7] == 4, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[8] == 4, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3[9] == 5, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array3.IsSorted(), "DynamicArray Sort");

			array4.Sort();
			
			UNIT_TEST_POSITIVE(array4[0] == 1, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array4[1] == 2, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array4[2] == 3, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array4[3] == 4, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array4[4] == 5, "DynamicArray Sort");
			UNIT_TEST_POSITIVE(array4.IsSorted(), "DynamicArray Sort");

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();
						
			int cArray1[5] = {1, 2, 3, 4, 5};
			int cArray2[5] = {4, 2, 5, 1, 3};

			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 5);
			Dia::Core::Containers::DynamicArray<int> array2(cArray2, 5);
			
			array1.Swap(array2);
			
			UNIT_TEST_POSITIVE(array1[0] == 4, "DynamicArray Swap");
			UNIT_TEST_POSITIVE(array1[1] == 2, "DynamicArray Swap");
			UNIT_TEST_POSITIVE(array1[2] == 5, "DynamicArray Swap");
			UNIT_TEST_POSITIVE(array1[3] == 1, "DynamicArray Swap");
			UNIT_TEST_POSITIVE(array1[4] == 3, "DynamicArray Swap");

			UNIT_TEST_POSITIVE(array2[0] == 1, "DynamicArray Swap");
			UNIT_TEST_POSITIVE(array2[1] == 2, "DynamicArray Swap");
			UNIT_TEST_POSITIVE(array2[2] == 3, "DynamicArray Swap");
			UNIT_TEST_POSITIVE(array2[3] == 4, "DynamicArray Swap");
			UNIT_TEST_POSITIVE(array2[4] == 5, "DynamicArray Swap");

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();
						
			int cArray1[10] = {1, 2, 3, 4, 5, 6, 3, 4, 5, 7};

			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 10);
			
			class OneLess
			{
			public:
				bool Equal(const int& object1, const int& object2)const
				{
					return (object1 == (object2 - 1));
				}
			};
			
			OneLess oneLess;

			UNIT_TEST_ASSERT_EXPECTED_START();
			array1.FindBetweenIndex(5, -2, 3);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			array1.FindBetweenIndex(5, 3, 1);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			array1.FindBetweenIndex(5, 0, 17);
			UNIT_TEST_ASSERT_EXPECTED_END();

			UNIT_TEST_POSITIVE(array1.FindIndex(5) == 4 , "DynamicArray FindIndex");
			UNIT_TEST_POSITIVE(array1.FindIndex(7) == 9, "DynamicArray FindIndex");
			UNIT_TEST_POSITIVE(array1.FindIndex(10) == -1, "DynamicArray FindIndex");

			UNIT_TEST_POSITIVE(array1.FindBetweenIndex(5, 0, 7) == 4 , "DynamicArray FindBetweenIndex");
			UNIT_TEST_POSITIVE(array1.FindBetweenIndex(5, 6, 9) == 8, "DynamicArray FindBetweenIndex");
			UNIT_TEST_POSITIVE(array1.FindBetweenIndex(1, 6, 9) == -1, "DynamicArray FindBetweenIndex");
			
			UNIT_TEST_POSITIVE(array1.FindIndex(5, oneLess) == 3 , "DynamicArray FindIndex");
			UNIT_TEST_POSITIVE(array1.FindIndex(7, oneLess) == 5, "DynamicArray FindIndex");
			UNIT_TEST_POSITIVE(array1.FindIndex(10, oneLess) == -1, "DynamicArray FindIndex");

			UNIT_TEST_POSITIVE(array1.FindBetweenIndex(5, oneLess, 0, 7) == 3 , "DynamicArray FindBetweenIndex");
			UNIT_TEST_POSITIVE(array1.FindBetweenIndex(5, oneLess, 6, 9) == 7, "DynamicArray FindBetweenIndex");
			UNIT_TEST_POSITIVE(array1.FindBetweenIndex(1, oneLess, 6, 9) == -1, "DynamicArray FindBetweenIndex");

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();
						
			int cArray1[10] = {1, 2, 3, 4, 5, 6, 3, 4, 5, 7};

			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 10);
			
			class OneLess
			{
			public:
				bool Equal(const int& object1, const int& object2)const
				{
					return (object1 == (object2 - 1));
				}
			};
			
			OneLess oneLess;

			UNIT_TEST_ASSERT_EXPECTED_START();
			array1.FindLastBetweenIndex(5, -2, 3);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			array1.FindLastBetweenIndex(5, 3, 1);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			UNIT_TEST_ASSERT_EXPECTED_START();
			array1.FindLastBetweenIndex(5, 0, 17);
			UNIT_TEST_ASSERT_EXPECTED_END();

			UNIT_TEST_POSITIVE(array1.FindLastIndex(5) == 8 , "DynamicArray FindLastIndex");
			UNIT_TEST_POSITIVE(array1.FindLastIndex(3) == 6, "DynamicArray FindLastIndex");
			UNIT_TEST_POSITIVE(array1.FindLastIndex(10) == -1, "DynamicArray FindLastIndex");

			UNIT_TEST_POSITIVE(array1.FindLastBetweenIndex(4, 0, 7) == 7 , "DynamicArray FindLastBetweenIndex");
			UNIT_TEST_POSITIVE(array1.FindLastBetweenIndex(5, 6, 9) == 8, "DynamicArray FindLastBetweenIndex");
			UNIT_TEST_POSITIVE(array1.FindLastBetweenIndex(1, 6, 9) == -1, "DynamicArray FindLastBetweenIndex");
			
			UNIT_TEST_POSITIVE(array1.FindLastIndex(5, oneLess) == 7 , "DynamicArray FindLastIndex");
			UNIT_TEST_POSITIVE(array1.FindLastIndex(7, oneLess) == 5, "DynamicArray FindLastIndex");
			UNIT_TEST_POSITIVE(array1.FindLastIndex(10, oneLess) == -1, "DynamicArray FindLastIndex");

			UNIT_TEST_POSITIVE(array1.FindLastBetweenIndex(5, oneLess, 0, 7) == 7 , "DynamicArray FindLastBetweenIndex");
			UNIT_TEST_POSITIVE(array1.FindLastBetweenIndex(5, oneLess, 6, 9) == 7, "DynamicArray FindLastBetweenIndex");
			UNIT_TEST_POSITIVE(array1.FindLastBetweenIndex(1, oneLess, 6, 9) == -1, "DynamicArray FindLastBetweenIndex");

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();
						
			int cArray1[10] = {1, 2, 3, 4, 5, 6, 3, 4, 5, 7};

			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 10);
			
			array1.Sort();

			class Equality
			{
			public:
				bool GreaterThen(const int& object1, const int& object2)const
				{
					return (object1 > object2);
				}
				bool LessThen(const int& object1, const int& object2)const
				{
					return (object1 < object2);
				}
				bool Equal(const int& object1, const int& object2)const
				{
					return (object1 == object2);
				}
			};
			
			Equality equality;
			
			UNIT_TEST_POSITIVE(array1.IsSorted(), "DynamicArray FindSortedIndex");

			UNIT_TEST_POSITIVE(array1.FindSortedIndex(5) == 6 , "DynamicArray FindSortedIndex");
			UNIT_TEST_POSITIVE(array1.FindSortedIndex(3) == 2, "DynamicArray FindSortedIndex");
			UNIT_TEST_POSITIVE(array1.FindSortedIndex(10) == -1, "DynamicArray FindSortedIndex");

			UNIT_TEST_POSITIVE(array1.FindLastSortedIndex(4) == 5 , "DynamicArray FindLastSortedIndex");
			UNIT_TEST_POSITIVE(array1.FindLastSortedIndex(5) == 7, "DynamicArray FindLastSortedIndex");
			UNIT_TEST_POSITIVE(array1.FindLastSortedIndex(10) == -1, "DynamicArray FindLastSortedIndex");
			
			UNIT_TEST_POSITIVE(array1.FindSortedIndex(5, equality) == 6 , "DynamicArray FindSortedIndex");
			UNIT_TEST_POSITIVE(array1.FindSortedIndex(3, equality) == 2, "DynamicArray FindSortedIndex");
			UNIT_TEST_POSITIVE(array1.FindSortedIndex(10, equality) == -1, "DynamicArray FindSortedIndex");

			UNIT_TEST_POSITIVE(array1.FindLastSortedIndex(4, equality) == 5 , "DynamicArray FindLastSortedIndex");
			UNIT_TEST_POSITIVE(array1.FindLastSortedIndex(5, equality) == 7, "DynamicArray FindLastSortedIndex");
			UNIT_TEST_POSITIVE(array1.FindLastSortedIndex(10, equality) == -1, "DynamicArray FindLastSortedIndex");

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();
			
		class Eval
			{
			public:
				float Evaluate(const int& object1)const
				{
					return static_cast<float>(object1);
				};
			};

			Eval eval;

			int cArray1[10] = {1, 2, 3, 9, 5, 6, 3, 4, 5, 7};
			
			Dia::Core::Containers::DynamicArray<int> array1(cArray1, 10);
					
			UNIT_TEST_POSITIVE(array1.HighestEvalutionIndex(eval) == 3, "DynamicArray HighestEvalutionIndex");

		UNIT_TEST_BLOCK_END();
		
		UNIT_TEST_BLOCK_START();
			
			class Foo
			{
			public:
				Foo(): mSomeData(true), mMoreData(21.0f){}

				bool SomeData(){return mSomeData;}
				float MoreData(){return mMoreData;}
			
				bool	mSomeData;
				float	mMoreData;
			};

			Foo cArray1[3];
			
			Dia::Core::Containers::DynamicArray<Foo> array1(cArray1, 3);
			
			cArray1[0].mSomeData = false;
			cArray1[0].mMoreData = 11.0f;

			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray Test Non primitive");
			UNIT_TEST_POSITIVE(array1.At(0).SomeData(), "DynamicArray Test Non primitive");	
			UNIT_TEST_POSITIVE(array1.At(1).SomeData(), "DynamicArray Test Non primitive");
			UNIT_TEST_POSITIVE(array1.At(2).SomeData(), "DynamicArray Test Non primitive");

			UNIT_TEST_POSITIVE(array1.At(0).MoreData() == 21.0f, "DynamicArray Test Non primitive");	
			UNIT_TEST_POSITIVE(array1.At(1).MoreData() == 21.0f, "DynamicArray Test Non primitive");
			UNIT_TEST_POSITIVE(array1.At(2).MoreData() == 21.0f, "DynamicArray Test Non primitive");

		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();

			Dia::Core::Containers::DynamicArray<int> array1(3);

			array1.Add(1);
			array1.AddDefault();
			array1.Add(2);
			
			UNIT_TEST_POSITIVE(array1.Size() == 3, "DynamicArray Add");
			UNIT_TEST_POSITIVE(array1.At(0) == 1, "DynamicArray Add");	
			UNIT_TEST_POSITIVE(array1.At(1) == 0, "DynamicArray AddDefault");
			UNIT_TEST_POSITIVE(array1.At(2) == 2, "DynamicArray Add");
			
			Dia::Core::Containers::DynamicArray<int> array2(3);
			
			array2.FillDefault();

			UNIT_TEST_POSITIVE(array2.Size() == 3, "DynamicArray Add");
			UNIT_TEST_POSITIVE(array2.At(0) == 0, "DynamicArray FillDefault");	
			UNIT_TEST_POSITIVE(array2.At(1) == 0, "DynamicArray FillDefault");
			UNIT_TEST_POSITIVE(array2.At(2) == 0, "DynamicArray FillDefault");
			
			Dia::Core::Containers::DynamicArray<int> array3(3);
			array3.Fill(11);

			UNIT_TEST_POSITIVE(array3.Size() == 3, "DynamicArray Add");
			UNIT_TEST_POSITIVE(array3.At(0) == 11, "DynamicArray Fill");	
			UNIT_TEST_POSITIVE(array3.At(1) == 11, "DynamicArray Fill");
			UNIT_TEST_POSITIVE(array3.At(2) == 11, "DynamicArray Fill");
			
			Dia::Core::Containers::DynamicArray<int> array4(3);
			array4.FillDefault();

			UNIT_TEST_POSITIVE(array4.Size() == 3, "DynamicArray Add");
			UNIT_TEST_POSITIVE(array4.At(0) == 0, "DynamicArray Fill");	
			UNIT_TEST_POSITIVE(array4.At(1) == 0, "DynamicArray Fill");
			UNIT_TEST_POSITIVE(array4.At(2) == 0, "DynamicArray Fill");

			Dia::Core::Containers::DynamicArray<int> array5(5);
			array5.AddDefault();
			array5.AddAt(1, 0);
			array5.AddAt(2, 1);
			array5.AddAt(3, 1);
			array5.AddAt(4, 3);
			UNIT_TEST_POSITIVE(array5.Size() == 5, "DynamicArray Add");
			UNIT_TEST_POSITIVE(array5.At(0) == 1, "DynamicArray Fill");	
			UNIT_TEST_POSITIVE(array5.At(1) == 3, "DynamicArray Fill");
			UNIT_TEST_POSITIVE(array5.At(2) == 2, "DynamicArray Fill");
			UNIT_TEST_POSITIVE(array5.At(3) == 4, "DynamicArray Fill");
			UNIT_TEST_POSITIVE(array5.At(4) == 0, "DynamicArray Fill");
	
		UNIT_TEST_BLOCK_END();

		UNIT_TEST_BLOCK_START();

			Dia::Core::Containers::DynamicArray<int> array1(3);
			array1.Fill(11);

			array1.Remove();
			UNIT_TEST_POSITIVE(array1.Size() == 2, "DynamicArray Remove");
			UNIT_TEST_POSITIVE(array1.At(0) == 11, "DynamicArray Remove");	
			UNIT_TEST_POSITIVE(array1.At(1) == 11, "DynamicArray Remove");

			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array1.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

			Dia::Core::Containers::DynamicArray<int> array2(3);
			array2.Add(1);
			array2.Add(2);
			array2.Add(3);
			array2.RemoveAt(1);
			
			UNIT_TEST_POSITIVE(array2.Size() == 2, "DynamicArray Remove");
			UNIT_TEST_POSITIVE(array2.At(0) == 1, "DynamicArray Remove");	
			UNIT_TEST_POSITIVE(array2.At(1) == 3, "DynamicArray Remove");

			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array2.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			Dia::Core::Containers::DynamicArray<int> array3(3);
			array3.Add(1);
			array3.Add(2);
			array3.Add(3);
			
			array3.RemoveFirst(2);
			
			UNIT_TEST_POSITIVE(array3.Size() == 2, "DynamicArray Remove");
			UNIT_TEST_POSITIVE(array3.At(0) == 1, "DynamicArray Remove");	
			UNIT_TEST_POSITIVE(array3.At(1) == 3, "DynamicArray Remove");

			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array3.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			Dia::Core::Containers::DynamicArray<int> array4(3);
			array4.Add(1);
			array4.Add(2);
			array4.Add(3);
			
			array4.RemoveLast(2);
			
			UNIT_TEST_POSITIVE(array4.Size() == 2, "DynamicArray Remove");
			UNIT_TEST_POSITIVE(array4.At(0) == 1, "DynamicArray Remove");	
			UNIT_TEST_POSITIVE(array4.At(1) == 3, "DynamicArray Remove");

			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array4.At(2) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();

			Dia::Core::Containers::DynamicArray<int> array5(3);
			array5.Add(1);
			array5.Add(2);
			array5.Add(3);
			
			array5.RemoveAll();
			
			UNIT_TEST_POSITIVE(array5.Size() == 0, "DynamicArray Remove");
			
			Dia::Core::Containers::DynamicArray<int> array6(5);
			array6.Add(1);
			array6.Add(2);
			array6.Add(3);
			array6.Add(2);
			array6.Add(3);
			
			array6.RemoveAll(2);
			
			UNIT_TEST_POSITIVE(array6.Size() == 3, "DynamicArray Remove");
			UNIT_TEST_POSITIVE(array6.At(0) == 1, "DynamicArray Remove");	
			UNIT_TEST_POSITIVE(array6.At(1) == 3, "DynamicArray Remove");
			UNIT_TEST_POSITIVE(array6.At(2) == 3, "DynamicArray Remove");

			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array6.At(3) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
			class Comparisson
			{
			public:
				bool Evaluate(const int&a)const
				{
					return (a == 2);
				};
			};
			
			Comparisson compare;
			
			Dia::Core::Containers::DynamicArray<int> array7(5);
			array7.Add(1);
			array7.Add(2);
			array7.Add(3);
			array7.Add(2);
			array7.Add(3);
			
			array7.RemoveAll(compare);
			
			UNIT_TEST_POSITIVE(array7.Size() == 3, "DynamicArray Remove");
			UNIT_TEST_POSITIVE(array7.At(0) == 1, "DynamicArray Remove");	
			UNIT_TEST_POSITIVE(array7.At(1) == 3, "DynamicArray Remove");
			UNIT_TEST_POSITIVE(array7.At(2) == 3, "DynamicArray Remove");

			UNIT_TEST_ASSERT_EXPECTED_START();
			bool test = (array7.At(3) == 0);
			UNIT_TEST_ASSERT_EXPECTED_END();
			
		UNIT_TEST_BLOCK_END();
		
		mState = kFinished;
	}
Beispiel #19
0
TEST(FixedArray,size_test){
    FixedArray<int> array(7);
    ASSERT_EQ(7,array.size());
    FixedArray<int> array2(100);
    ASSERT_EQ(100,array2.size());
}
// a utility function to compare two parameter arrays
::testing::AssertionResult compareParameterArrays(std::shared_ptr<Region> region1,
                                                  std::shared_ptr<Region> region2,
                                                  std::string parameter,
                                                  NTA_BasicType type) {
  UInt32 *buf1;
  UInt32 *buf2;
  Real32 *buf3;
  Real32 *buf4;
  Real64 *buf5;
  Real64 *buf6;
  Byte   *buf7;
  Byte   *buf8;
  Array array1(type);
  Array array2(type);
  region1->getParameterArray(parameter, array1);
  region2->getParameterArray(parameter, array2);


  if (type != array1.getType())
    return ::testing::AssertionFailure()
           << "Failure: Original Array1 for parameter '" << parameter
           << "' is not the expected type. expected: "
           << BasicType::getName(type) << ", found: "
          << BasicType::getName(array1.getType());
  if (type != array2.getType())
    return ::testing::AssertionFailure()
           << "Failure: Restored Array2 for parameter '" << parameter
           << "' is not the expected type. expected: "
           << BasicType::getName(type) << ", found: "
          << BasicType::getName(array1.getType());

  size_t len1 = array1.getCount();
  size_t len2 = array2.getCount();
  if (len1 != len2) {
    return ::testing::AssertionFailure()
           << "Failure: Arrays for parameter '" << parameter
           << "' are not the same length.";
  }
  switch (type) {
  case NTA_BasicType_UInt32:
    buf1 = (UInt32 *)array1.getBuffer();
    buf2 = (UInt32 *)array2.getBuffer();
    for (size_t i = 0; i < len1; i++) {
      if (buf1[i] != buf2[i]) {
        return ::testing::AssertionFailure()
               << "Failure: Array element for parameter '" << parameter << "["
               << i << "]' is not the same after restore.";
      }
    }
    break;

  case NTA_BasicType_Real32:
    buf3 = (Real32 *)array1.getBuffer();
    buf4 = (Real32 *)array2.getBuffer();
    for (size_t i = 0; i < len1; i++) {
      if (buf3[i] != buf4[i]) {
        return ::testing::AssertionFailure()
               << "Failure: Array element for parameter '" << parameter << "["
               << i << "]' is not the same after restore.";
      }
    }
    break;

  case NTA_BasicType_Real64:
    buf5 = (Real64 *)array1.getBuffer();
    buf6 = (Real64 *)array2.getBuffer();
    for (size_t i = 0; i < len1; i++) {
      if (buf5[i] != buf6[i]) {
        return ::testing::AssertionFailure()
               << "Failure: Array element for parameter '" << parameter << "["
               << i << "]' is not the same after restore.";
      }
    }
    break;
  case NTA_BasicType_Byte:
  case NTA_BasicType_SDR:
    buf7 = (Byte *)array1.getBuffer();
    buf8 = (Byte *)array2.getBuffer();
    for (size_t i = 0; i < len1; i++) {
      if (buf7[i] != buf8[i]) {
        return ::testing::AssertionFailure()
               << "Failure: Array element for parameter '" << parameter << "["
               << i << "]' is not the same after restore.";
      }
    }
    break;
  default:
    break;
  } // end switch
  return ::testing::AssertionSuccess();
}
void tst_QCustomDataArray::create()
{
    QCustomDataArray array1;
    QVERIFY(array1.elementType() == QCustomDataArray::Float);
    QVERIFY(array1.elementSize() == sizeof(float));
    QCOMPARE(array1.size(), 0);
    QCOMPARE(array1.count(), 0);
    QVERIFY(array1.isEmpty());

    array1.setElementType(QCustomDataArray::Vector3D);
    QVERIFY(array1.elementType() == QCustomDataArray::Vector3D);
    QVERIFY(array1.elementSize() == sizeof(QVector3D));
    QCOMPARE(array1.size(), 0);
    QCOMPARE(array1.count(), 0);
    QVERIFY(array1.isEmpty());

    QCustomDataArray array2(QCustomDataArray::Vector2D);
    QVERIFY(array2.elementType() == QCustomDataArray::Vector2D);
    QVERIFY(array2.elementSize() == sizeof(QVector2D));
    QCOMPARE(array2.size(), 0);
    QCOMPARE(array2.count(), 0);
    QVERIFY(array2.isEmpty());

    QCustomDataArray array3(QCustomDataArray::Vector3D, 20);
    QVERIFY(array3.elementType() == QCustomDataArray::Vector3D);
    QVERIFY(array3.elementSize() == sizeof(QVector3D));
    QCOMPARE(array3.size(), 20);
    QCOMPARE(array3.count(), 20);
    QVERIFY(!array3.isEmpty());
    QVERIFY(array3.capacity() >= 20);

    QCustomDataArray array4(QCustomDataArray::Vector4D, 20);
    QVERIFY(array4.elementType() == QCustomDataArray::Vector4D);
    QVERIFY(array4.elementSize() == sizeof(QVector4D));
    QCOMPARE(array4.size(), 20);
    QCOMPARE(array4.count(), 20);
    QVERIFY(!array4.isEmpty());
    array4.append(QVector4D(1.0f, 2.0f, 3.0f, 4.0f));

    QCustomDataArray array5(QCustomDataArray::Color, 10);
    QVERIFY(array5.elementType() == QCustomDataArray::Color);
    QVERIFY(array5.elementSize() == sizeof(QColor4ub));
    QCOMPARE(array5.size(), 10);
    QCOMPARE(array5.count(), 10);
    QVERIFY(!array5.isEmpty());
    array5.append(Qt::red);
    array5.setAt(4, Qt::green);
    QVERIFY(array5.colorAt(4) == Qt::green);

    QCustomDataArray array6(array5);
    QVERIFY(array6.elementType() == QCustomDataArray::Color);
    QVERIFY(array6.elementSize() == sizeof(QColor4ub));
    QCOMPARE(array6.size(), 11);
    QCOMPARE(array6.count(), 11);
    QVERIFY(!array6.isEmpty());
    QVERIFY(array6.colorAt(10) == Qt::red);

    // Changes element type from Color to Vector4D.
    array6 = array4;
    QVERIFY(array6.elementType() == QCustomDataArray::Vector4D);
    QVERIFY(array6.elementSize() == sizeof(QVector4D));
    QCOMPARE(array6.size(), 21);
    QCOMPARE(array6.count(), 21);
    QVERIFY(!array6.isEmpty());
    QVERIFY(array6.vector4DAt(20) == QVector4D(1.0f, 2.0f, 3.0f, 4.0f));

    array6.clear();
    QVERIFY(array6.elementType() == QCustomDataArray::Vector4D);
    QVERIFY(array6.elementSize() == sizeof(QVector4D));
    QCOMPARE(array6.size(), 0);
    QCOMPARE(array6.count(), 0);
    QVERIFY(array6.isEmpty());

    array6.setElementType(QCustomDataArray::Vector3D);
    QVERIFY(array6.elementType() == QCustomDataArray::Vector3D);
    QVERIFY(array6.elementSize() == sizeof(QVector3D));
    QCOMPARE(array6.size(), 0);
    QCOMPARE(array6.count(), 0);
    QVERIFY(array6.isEmpty());
}
    bool operator() ()
    {
        bool passed = true;
        printf("%s::%s ... ",TOSTRING(isa),name);
        fflush(stdout);

        /* create vector with random numbers */
        const size_t M = 10;
        std::vector<atomic_t> flattened;
        typedef std::vector<std::vector<size_t>* > ArrayArray;
        ArrayArray array2(M);
        size_t K = 0;
        for (size_t i=0; i<M; i++) {
            const size_t N = rand() % 10;
            K += N;
            array2[i] = new std::vector<size_t>(N);
            for (size_t j=0; j<N; j++)
                (*array2[i])[j] = rand() % 10;
        }

        /* array to test global index */
        std::vector<atomic_t> verify_k(K);
        for (size_t i=0; i<K; i++) verify_k[i] = 0;

        ParallelForForPrefixSumState<size_t> state(array2,size_t(1));

        /* dry run only counts */
        size_t S = parallel_for_for_prefix_sum( state, array2, size_t(0), [&](std::vector<size_t>* v, const range<size_t>& r, size_t k, const size_t base) -> size_t
        {
            size_t s = 0;
            for (size_t i=r.begin(); i<r.end(); i++) {
                s += (*v)[i];
                atomic_add(&verify_k[k++],1);
            }
            return s;
        }, [](size_t v0, size_t v1) {
            return v0+v1;
        });

        /* create properly sized output array */
        flattened.resize(S);
        memset(flattened.data(),0,sizeof(atomic_t)*S);

        /* now we actually fill the flattened array */
        parallel_for_for_prefix_sum( state, array2, size_t(0), [&](std::vector<size_t>* v, const range<size_t>& r, size_t k, const size_t base) -> size_t
        {
            size_t s = 0;
            for (size_t i=r.begin(); i<r.end(); i++) {
                for (size_t j=0; j<(*v)[i]; j++) {
                    atomic_add(&flattened[base+s+j],1);
                }
                s += (*v)[i];
                atomic_add(&verify_k[k++],1);
            }
            return s;
        }, [](size_t v0, size_t v1) {
            return v0+v1;
        });

        /* check global index */
        for (size_t i=0; i<K; i++)
            passed &= (verify_k[i] == 2);

        /* check if each element was assigned exactly once */
        for (size_t i=0; i<flattened.size(); i++)
            passed &= (flattened[i] == 1);

        /* delete arrays again */
        for (size_t i=0; i<array2.size(); i++)
            delete array2[i];

        /* output if test passed or not */
        if (passed) printf("[passed]\n");
        else        printf("[failed]\n");

        return passed;
    }