void test_cached_control() { #define TEST_LLCC(T, V) if((T)mySetting_##T != V) llerrs << "Fail "#T << llendl TEST_LLCC(U32, 666); TEST_LLCC(S32, (S32)-666); TEST_LLCC(F32, (F32)-666.666); TEST_LLCC(bool, true); TEST_LLCC(BOOL, FALSE); if((std::string)mySetting_string != "Default String Value") llerrs << "Fail string" << llendl; TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); TEST_LLCC(LLRect, LLRect(0, 0, 100, 500)); TEST_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f)); TEST_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f)); TEST_LLCC(LLColor4U, LLColor4U(255, 200, 100, 255)); //There's no LLSD comparsion for LLCC yet. TEST_LLCC(LLSD, test_llsd); if((std::string)test_BrowserHomePage != "http://www.secondlife.com") llerrs << "Fail BrowserHomePage" << llendl; }
void test_cached_control() { static const LLCachedControl<std::string> mySetting_string("TestCachedControlstring", "Default String Value"); static const LLCachedControl<std::string> test_BrowserHomePage("BrowserHomePage", "hahahahahha", "Not the real comment"); #define TEST_LLCC(T, V) if((T)mySetting_##T != V) llerrs << "Fail "#T << llendl; \ mySetting_##T = V;\ if((T)mySetting_##T != V) llerrs << "Fail "#T << "Pass # 2" << llendl; TEST_LLCC(U32, 666); TEST_LLCC(S32, (S32)-666); TEST_LLCC(F32, (F32)-666.666); TEST_LLCC(bool, true); TEST_LLCC(BOOL, FALSE); if((std::string)mySetting_string != "Default String Value") llerrs << "Fail string" << llendl; TEST_LLCC(LLVector3, LLVector3(1.0f, 2.0f, 3.0f)); TEST_LLCC(LLVector3d, LLVector3d(6.0f, 5.0f, 4.0f)); TEST_LLCC(LLRect, LLRect(0, 0, 100, 500)); TEST_LLCC(LLColor4, LLColor4(0.0f, 0.5f, 1.0f)); TEST_LLCC(LLColor3, LLColor3(1.0f, 0.f, 0.5f)); //There's no LLSD comparsion for LLCC yet. TEST_LLCC(LLSD, test_llsd); if((std::string)test_BrowserHomePage != "http://www.singularityviewer.org") llerrs << "Fail BrowserHomePage" << llendl; }