TEST(Enum, EnumInterface) { openstudio::enums::TestEnum te1("THIRD"); openstudio::enums::TestEnum2 te2("SeConD"); openstudio::enums::TestEnum3 te3(3); openstudio::enums::TestEnum3 te4("SIXTH"); EXPECT_THROW(openstudio::enums::TestEnum3 te5("Seventh"), std::runtime_error); // does not exist EXPECT_EQ("third", te1.valueName()); EXPECT_EQ("TestEnum", te1.enumName()); EXPECT_EQ(2, te2.value()); EXPECT_EQ("second", te2.valueName()); EXPECT_EQ("TestEnum2", te2.enumName()); EXPECT_EQ(static_cast<openstudio::enums::TestEnum2::domain>(2), te2.value()); EXPECT_EQ("third", te3.valueName()); EXPECT_EQ("TestEnum3", te3.enumName()); EXPECT_EQ(static_cast<openstudio::enums::TestEnum3::domain>(3), te3.value()); EXPECT_EQ("SIXTH", te4.valueName()); EXPECT_EQ("TestEnum3", te4.enumName()); EXPECT_EQ(static_cast<openstudio::enums::TestEnum3::domain>(6), te4.value()); // Integer comparison EXPECT_TRUE(te4 > 3); }
void HalfEdgeSelector_Radiance<PFP>::updateAfterCollapse(Dart d2, Dart dd2) { MAP& m = this->m_map ; Dart stop = m.phi2(m.phi_1(d2)); recomputeQuadric(d2); Dart it = dd2; do { recomputeQuadric(m.phi1(it)); it = m.phi2(m.phi_1(it)); } while (it != stop); DartMarkerStore<MAP> dm(m); Traversor2VVaE<MAP> tv(m, d2); for (Dart v = tv.begin() ; v != tv.end() ; v = tv.next()) { dm.mark(v); updateHalfEdgeInfo(v, true); } it = dd2; do { Traversor2VVaE<MAP> tv2(m, m.phi1(it)); for (Dart v = tv2.begin() ; v != tv2.end() ; v = tv2.next()) { dm.mark(v); updateHalfEdgeInfo(v, true); } it = m.phi2(m.phi_1(it)); } while (it != stop); Traversor2VE<MAP> te(m, d2); for (Dart v = te.begin() ; v != te.end() ; v = te.next()) { if (!dm.isMarked(v)) updateHalfEdgeInfo(v, false); } it = dd2; do { Traversor2VE<MAP> te2(m, m.phi1(it)); for (Dart v = te2.begin() ; v != te2.end() ; v = te2.next()) { if (!dm.isMarked(v)) updateHalfEdgeInfo(v, false); } it = m.phi2(m.phi_1(it)); } while (it != stop); cur = halfEdges.begin() ; // set the current edge to the first one }
int main() { { std::pair< node::ptr_t, node::ptr_t > pt = create_eq_trees(); coro_t te1( boost::bind( enumerate_leafs, _1, pt.first) ); coro_t te2( boost::bind( enumerate_leafs, _1, pt.second) ); bool result = match_trees( te1, te2); std::cout << std::boolalpha << "eq. trees matched == " << result << std::endl; } { std::pair< node::ptr_t, node::ptr_t > pt = create_diff_trees(); coro_t te1( boost::bind( enumerate_leafs, _1, pt.first) ); coro_t te2( boost::bind( enumerate_leafs, _1, pt.second) ); bool result = match_trees( te1, te2); std::cout << std::boolalpha << "diff. trees matched == " << result << std::endl; } std::cout << "Done" << std::endl; return EXIT_SUCCESS; }
int main(int argc, char * argv[]){ Triangle t1(3,3,3,1,1); Square s1(6,2,2); Circle c1(7,3,3); Sphere sp1(10,4,4,4); Cube cu1(10,5,5,5); Tetrahedron te1(5,6,7,8,9,10,6,6,6); Cube cu2(5,7,7,7); Square s2(16,8,8); Circle c2(1,9,9); Circle c3(55,10,10); Square s3(3,11,11); Tetrahedron te2(3,3,3,3,3,3,12,12,12); Shape * arr = new Shape[12]; arr[0] = t1; arr[1] = s1; arr[2] = c1; arr[3] = sp1; arr[4] = cu1; arr[5] = te1; arr[6] = cu2; arr[7] = s2; arr[8] = c2; arr[9] = c3; arr[10] = s3; arr[11] = te2; for(int i = 0; i < 11; ++i){ cout << endl; if(arr[i].getT() == 2){ cout << "2-D Shape Found" << endl; cout << "Points are: (" << arr[i].getX() << ", " << arr[i].getY() << ")" << endl; cout << "Area is: " << arr[i].getArea() << endl; } else{ cout << "3-D Shape" << endl; cout << "At Pt: (" << arr[i].getX() << ", " << arr[i].getY() << ", " << arr[i].getZ() <<")" << endl; cout << "Surface Area is: " << arr[i].getSurface() << endl; cout << "Volume is: " << arr[i].getVolume() << endl; } } delete[] arr; return 0; }
int main(int argc, char* argv[]){ const size_t index = 3; const size_t test_index = 2; Graphical::Engine * graphics = new Graphical::Engine; graphics->setup(); graphics->manager(); World::Earth * bullet = World::EarthFactory::getEarthFactory(2)->instantiate(); TestEnvironment te1(graphics,bullet); World::Earth * physx = World::EarthFactory::getEarthFactory(3)->instantiate(); TestEnvironment te2(graphics,physx); World::Earth * ode = World::EarthFactory::getEarthFactory(4)->instantiate(); TestEnvironment te3(graphics,ode); Testing t1,t2,t3; //std::cout << "Engine: " << World::EarthFactory::getEarthFactory(index)->getName() << std::endl; //t1.instantiate(&te1,5,test_index); //t2.instantiate(&te2,5,test_index); t3.instantiate(&te3,5,test_index); double elapsedTime = 0; while(!graphics->exitRequested()){ timeval _t1, _t2; gettimeofday(&_t1, NULL); graphics->render(); bullet->tick(elapsedTime/1000.f); physx->tick(elapsedTime/1000.f); ode->tick(elapsedTime/1000.f); t1.update(); t2.update(); t3.update(); gettimeofday(&_t2, NULL); elapsedTime = (_t2.tv_sec - _t1.tv_sec) * 1000.0 + (_t2.tv_usec - _t1.tv_usec) / 1000.0; // us to ms } graphics->closeup(); delete graphics; delete physx; delete bullet; return 0; }