diff options
Diffstat (limited to 'indra/llcommon/tests')
-rwxr-xr-x | indra/llcommon/tests/commonmisc_test.cpp | 10 | ||||
-rwxr-xr-x | indra/llcommon/tests/llerror_test.cpp | 90 | ||||
-rwxr-xr-x | indra/llcommon/tests/llsdserialize_test.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/tests/llunits_test.cpp | 6 |
4 files changed, 57 insertions, 51 deletions
diff --git a/indra/llcommon/tests/commonmisc_test.cpp b/indra/llcommon/tests/commonmisc_test.cpp index b115c153c1..4b3e07fa75 100755 --- a/indra/llcommon/tests/commonmisc_test.cpp +++ b/indra/llcommon/tests/commonmisc_test.cpp @@ -339,7 +339,7 @@ namespace tut /* if(actual != expected) { - llwarns << "iteration " << i << llendl; + LL_WARNS() << "iteration " << i << LL_ENDL; std::ostringstream e_str; std::string::iterator iter = expected.begin(); std::string::iterator end = expected.end(); @@ -349,8 +349,8 @@ namespace tut } e_str << std::endl; llsd_serialize_string(e_str, expected); - llwarns << "expected size: " << expected.size() << llendl; - llwarns << "expected: " << e_str.str() << llendl; + LL_WARNS() << "expected size: " << expected.size() << LL_ENDL; + LL_WARNS() << "expected: " << e_str.str() << LL_ENDL; std::ostringstream a_str; iter = actual.begin(); @@ -361,8 +361,8 @@ namespace tut } a_str << std::endl; llsd_serialize_string(a_str, actual); - llwarns << "actual size: " << actual.size() << llendl; - llwarns << "actual: " << a_str.str() << llendl; + LL_WARNS() << "actual size: " << actual.size() << LL_ENDL; + LL_WARNS() << "actual: " << a_str.str() << LL_ENDL; } */ ensure_equals("string value", actual, expected); diff --git a/indra/llcommon/tests/llerror_test.cpp b/indra/llcommon/tests/llerror_test.cpp index 279a90e51b..b28c5ba4b3 100755 --- a/indra/llcommon/tests/llerror_test.cpp +++ b/indra/llcommon/tests/llerror_test.cpp @@ -40,7 +40,7 @@ namespace { void test_that_error_h_includes_enough_things_to_compile_a_message() { - llinfos << "!" << llendl; + LL_INFOS() << "!" << LL_ENDL; } } @@ -55,7 +55,7 @@ namespace tut class TestRecorder : public LLError::Recorder { public: - TestRecorder() : mWantsTime(false) { } + TestRecorder() { mWantsTime = false; } ~TestRecorder() { LLError::removeRecorder(this); } void recordMessage(LLError::ELevel level, @@ -68,7 +68,6 @@ namespace tut void clearMessages() { mMessages.clear(); } void setWantsTime(bool t) { mWantsTime = t; } - bool wantsTime() { return mWantsTime; } std::string message(int n) { @@ -82,8 +81,6 @@ namespace tut private: typedef std::vector<std::string> MessageVector; MessageVector mMessages; - - bool mWantsTime; }; struct ErrorTestData @@ -144,8 +141,8 @@ namespace tut void ErrorTestObject::test<1>() // basic test of output { - llinfos << "test" << llendl; - llinfos << "bob" << llendl; + LL_INFOS() << "test" << LL_ENDL; + LL_INFOS() << "bob" << LL_ENDL; ensure_message_contains(0, "test"); ensure_message_contains(1, "bob"); @@ -156,11 +153,11 @@ namespace { void writeSome() { - lldebugs << "one" << llendl; - llinfos << "two" << llendl; - llwarns << "three" << llendl; - llerrs << "four" << llendl; - // fatal messages write out and addtional "error" message + LL_DEBUGS() << "one" << LL_ENDL; + LL_INFOS() << "two" << LL_ENDL; + LL_WARNS() << "three" << LL_ENDL; + // fatal messages write out an additional "error" message + LL_ERRS() << "four" << LL_ENDL; } }; @@ -259,19 +256,20 @@ namespace std::string writeReturningLocation() { - llinfos << "apple" << llendl; int this_line = __LINE__; + LL_INFOS() << "apple" << LL_ENDL; int this_line = __LINE__; return locationString(this_line); } - std::string writeReturningLocationAndFunction() + void writeReturningLocationAndFunction(std::string& location, std::string& function) { - llinfos << "apple" << llendl; int this_line = __LINE__; - return locationString(this_line) + __FUNCTION__; + LL_INFOS() << "apple" << LL_ENDL; int this_line = __LINE__; + location = locationString(this_line); + function = __FUNCTION__; } std::string errorReturningLocation() { - llerrs << "die" << llendl; int this_line = __LINE__; + LL_ERRS() << "die" << LL_ENDL; int this_line = __LINE__; return locationString(this_line); } } @@ -306,13 +304,13 @@ namespace tut std::string logFromGlobal(bool id) { - llinfos << (id ? "logFromGlobal: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "logFromGlobal: " : "") << "hi" << LL_ENDL; return "logFromGlobal"; } static std::string logFromStatic(bool id) { - llinfos << (id ? "logFromStatic: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "logFromStatic: " : "") << "hi" << LL_ENDL; return "logFromStatic"; } @@ -320,7 +318,7 @@ namespace { std::string logFromAnon(bool id) { - llinfos << (id ? "logFromAnon: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "logFromAnon: " : "") << "hi" << LL_ENDL; return "logFromAnon"; } } @@ -328,7 +326,7 @@ namespace namespace Foo { std::string logFromNamespace(bool id) { - llinfos << (id ? "Foo::logFromNamespace: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "Foo::logFromNamespace: " : "") << "hi" << LL_ENDL; //return "Foo::logFromNamespace"; // there is no standard way to get the namespace name, hence // we won't be testing for it @@ -342,12 +340,12 @@ namespace public: std::string logFromMember(bool id) { - llinfos << (id ? "ClassWithNoLogType::logFromMember: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "ClassWithNoLogType::logFromMember: " : "") << "hi" << LL_ENDL; return "ClassWithNoLogType::logFromMember"; } static std::string logFromStatic(bool id) { - llinfos << (id ? "ClassWithNoLogType::logFromStatic: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "ClassWithNoLogType::logFromStatic: " : "") << "hi" << LL_ENDL; return "ClassWithNoLogType::logFromStatic"; } }; @@ -357,12 +355,12 @@ namespace public: std::string logFromMember(bool id) { - llinfos << (id ? "ClassWithLogType::logFromMember: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "ClassWithLogType::logFromMember: " : "") << "hi" << LL_ENDL; return "ClassWithLogType::logFromMember"; } static std::string logFromStatic(bool id) { - llinfos << (id ? "ClassWithLogType::logFromStatic: " : "") << "hi" << llendl; + LL_INFOS() << (id ? "ClassWithLogType::logFromStatic: " : "") << "hi" << LL_ENDL; return "ClassWithLogType::logFromStatic"; } }; @@ -434,19 +432,19 @@ namespace { std::string innerLogger() { - llinfos << "inside" << llendl; + LL_INFOS() << "inside" << LL_ENDL; return "moo"; } std::string outerLogger() { - llinfos << "outside(" << innerLogger() << ")" << llendl; + LL_INFOS() << "outside(" << innerLogger() << ")" << LL_ENDL; return "bar"; } void uberLogger() { - llinfos << "uber(" << outerLogger() << "," << innerLogger() << ")" << llendl; + LL_INFOS() << "uber(" << outerLogger() << "," << innerLogger() << ")" << LL_ENDL; } class LogWhileLogging @@ -454,7 +452,7 @@ namespace public: void print(std::ostream& out) const { - llinfos << "logging" << llendl; + LL_INFOS() << "logging" << LL_ENDL; out << "baz"; } }; @@ -465,7 +463,7 @@ namespace void metaLogger() { LogWhileLogging l; - llinfos << "meta(" << l << ")" << llendl; + LL_INFOS() << "meta(" << l << ")" << LL_ENDL; } } @@ -495,7 +493,7 @@ namespace tut } template<> template<> - // special handling of llerrs calls + // special handling of LL_ERRS() calls void ErrorTestObject::test<8>() { LLError::setPrintLocation(false); @@ -518,7 +516,7 @@ namespace void ufoSighting() { - llinfos << "ufo" << llendl; + LL_INFOS() << "ufo" << LL_ENDL; } } @@ -548,11 +546,13 @@ namespace tut LLError::setPrintLocation(true); LLError::setTimeFunction(roswell); mRecorder->setWantsTime(true); - std::string locationAndFunction = writeReturningLocationAndFunction(); + std::string location, + function; + writeReturningLocationAndFunction(location, function); - ensure_equals("order is time type location function message", + ensure_equals("order is location time type function message", mRecorder->message(0), - roswell() + " INFO: " + locationAndFunction + ": apple"); + location + roswell() + " INFO: " + function + ": apple"); } template<> template<> @@ -562,7 +562,7 @@ namespace tut TestRecorder* altRecorder(new TestRecorder); LLError::addRecorder(altRecorder); - llinfos << "boo" << llendl; + LL_INFOS() << "boo" << LL_ENDL; ensure_message_contains(0, "boo"); ensure_equals("alt recorder count", altRecorder->countMessages(), 1); @@ -574,7 +574,7 @@ namespace tut anotherRecorder->setWantsTime(true); LLError::addRecorder(anotherRecorder); - llinfos << "baz" << llendl; + LL_INFOS() << "baz" << LL_ENDL; std::string when = roswell(); @@ -590,10 +590,10 @@ class TestAlpha { LOG_CLASS(TestAlpha); public: - static void doDebug() { lldebugs << "add dice" << llendl; } - static void doInfo() { llinfos << "any idea" << llendl; } - static void doWarn() { llwarns << "aim west" << llendl; } - static void doError() { llerrs << "ate eels" << llendl; } + static void doDebug() { LL_DEBUGS() << "add dice" << LL_ENDL; } + static void doInfo() { LL_INFOS() << "any idea" << LL_ENDL; } + static void doWarn() { LL_WARNS() << "aim west" << LL_ENDL; } + static void doError() { LL_ERRS() << "ate eels" << LL_ENDL; } static void doAll() { doDebug(); doInfo(); doWarn(); doError(); } }; @@ -601,10 +601,10 @@ class TestBeta { LOG_CLASS(TestBeta); public: - static void doDebug() { lldebugs << "bed down" << llendl; } - static void doInfo() { llinfos << "buy iron" << llendl; } - static void doWarn() { llwarns << "bad word" << llendl; } - static void doError() { llerrs << "big easy" << llendl; } + static void doDebug() { LL_DEBUGS() << "bed down" << LL_ENDL; } + static void doInfo() { LL_INFOS() << "buy iron" << LL_ENDL; } + static void doWarn() { LL_WARNS() << "bad word" << LL_ENDL; } + static void doError() { LL_ERRS() << "big easy" << LL_ENDL; } static void doAll() { doDebug(); doInfo(); doWarn(); doError(); } }; diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp index 4d436e8897..235008a5ae 100755 --- a/indra/llcommon/tests/llsdserialize_test.cpp +++ b/indra/llcommon/tests/llsdserialize_test.cpp @@ -268,7 +268,7 @@ namespace tut { std::stringstream stream; mFormatter->format(v, stream); - //llinfos << "checkRoundTrip: length " << stream.str().length() << llendl; + //LL_INFOS() << "checkRoundTrip: length " << stream.str().length() << LL_ENDL; LLSD w; mParser->reset(); // reset() call is needed since test code re-uses mParser mParser->parse(stream, w, stream.str().size()); diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp index e631f18ad4..ff981ca2ff 100644 --- a/indra/llcommon/tests/llunits_test.cpp +++ b/indra/llcommon/tests/llunits_test.cpp @@ -53,6 +53,7 @@ namespace tut template<> template<> void units_object_t::test<1>() { + LL_INFOS("test") << "Test" << LL_ENDL; LLUnit<F32, Quatloos> float_quatloos; ensure(float_quatloos == 0.f); @@ -93,6 +94,11 @@ namespace tut LLUnit<F32, Solari> solari(quatloos); ensure(solari == 4096); + + // division of integral unit + LLUnit<S32, Quatloos> single_quatloo(1); + LLUnit<F32, Latinum> quarter_latinum = single_quatloo; + ensure(quarter_latinum == 0.25f); } // conversions across non-base units |