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); }
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; }