int main(int p_argc, char* p_argv[]) { try { throw r2ExceptionRuntimeM("Error"); } catch (std::exception& p_exception) { std::cout << "Exception Test Passed" << std::endl; try { r2AssertM(false, "Error"); } catch (std::exception& p_exception) { std::cout << "Assertion Test Passed" << std::endl; } } std::cout << r2::Math::K_PI << std::endl; r2::Math::FloatCompare(0.0f, 0.0f); std::cout << "Math Test Passed" << std::endl; std::cout << "sizeof(r2::Byte): " << sizeof(r2::Byte) << std::endl; std::cout << "sizeof(r2::SInt8): " << sizeof(r2::SInt8) << std::endl; std::cout << "sizeof(r2::SInt16): " << sizeof(r2::SInt16) << std::endl; std::cout << "sizeof(r2::SInt32): " << sizeof(r2::SInt32) << std::endl; std::cout << "sizeof(r2::SInt64): " << sizeof(r2::SInt64) << std::endl; std::cout << "sizeof(r2::UInt8): " << sizeof(r2::UInt8) << std::endl; std::cout << "sizeof(r2::UInt16): " << sizeof(r2::UInt16) << std::endl; std::cout << "sizeof(r2::UInt32): " << sizeof(r2::UInt32) << std::endl; std::cout << "sizeof(r2::UInt64): " << sizeof(r2::UInt64) << std::endl; union { r2::UInt64 i; r2::Byte c[8]; } a = { 0x0102030405060708 }; r2::SwapEndian(a.i); r2AssertM(a.c[0] == 0x08 && a.c[1] == 0x07 && a.c[2] == 0x06 && a.c[3] == 0x05 && a.c[4] == 0x04 && a.c[5] == 0x03 && a.c[6] == 0x02 && a.c[7] == 0x01, "64-bit endian swap failed"); std::cout << "64-bit Endian Swap Test Succeeded" << std::endl; HighscoreList list; list.AddEntry("Rarosu", HighscoreList::Easy, 100); list.AddEntry("Raze", HighscoreList::Easy, 120); list.AddEntry("Rarosu", HighscoreList::Normal, 435); list.AddEntry("Raze", HighscoreList::Normal, 435); list.AddEntry("Rogan", HighscoreList::Hard, 695); list.AddEntry("Billy The Paperboy", HighscoreList::Hard, 780); list.Save("highscore.dat"); //list.Print(); HighscoreList loaded_list; loaded_list.Load("highscore.dat"); loaded_list.Print(); return 0; }
void ArgumentParser::Add(Option* p_option) { r2AssertM(p_option != 0, "Trying to add NULL Option pointer to the Argument Parser"); p_option->SetParser(this); // Add the Option. m_option_occurrences.push_back(OptionOccurrence(p_option)); // If the option has a short name add it as the key to the Option's position in m_options. if(p_option->HasShort()) m_shorts.insert(std::pair<char, int>(p_option->Short(), m_option_occurrences.size() - 1)); // If the option has a name add it as the key to the Option's position in m_options. if(p_option->HasName()) m_names.insert(std::pair<std::string, int>(p_option->Name(), m_option_occurrences.size() - 1)); }
const T& SingletonConst<T>::Instance() { r2AssertM(s_instance != NULL, "Singleton has not been created yet"); return *s_instance; }
SingletonConst<T>::~SingletonConst() { r2AssertM(s_instance != NULL, "A singleton was deleted without the static instance being set. Please report this."); s_instance = NULL; }
SingletonConst<T>::SingletonConst() { r2AssertM(s_instance == NULL, "Cannot create two or more instances of a singleton"); s_instance = GetDerivedAddress(this); }
T* Singleton<T>::InstancePtr() { r2AssertM(s_instance != NULL, "Singleton has not been created yet"); return s_instance; }