void testToTree() { // build test data int i = 0; MapArrayFloat64 a("SomeName"); for (i = 0; i < TestPoints::N; i++) { a.Add(TestPoints::data[i]); } // verify tree TreeList* t = TreeValueCast<TreeList>(a.ToTree()); CPPUNIT_ASSERT(t != NULL); CPPUNIT_ASSERT_EQUAL(string("SomeName"), t->ElementName()); CPPUNIT_ASSERT_EQUAL(size_t(TestPoints::N), t->NumElements()); for (i = 0; i < TestPoints::N; i++) { const TreeFloat64* v = TreeValueCast<TreeFloat64>( t->ElementArray()[i] ); CPPUNIT_ASSERT(v != NULL); CPPUNIT_ASSERT_DOUBLES_EQUAL(TestPoints::data[i], v->Value(), TestPoints::resolution); } }