Skip to content
Snippets Groups Projects
Commit 918e2b62 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

Bring in new TUT library build. Clean up ensure_equals() overloads.

The new TUT library build eliminates the ambiguity about ensure_equals(const
char*, ...) versus ensure_equals(const std::string&, ...). Now it's all based
on const std::string&. Remove pointless const char* overloads and ambiguous
forwarding templates.
With clang in Xcode 6, any new datatypes we intend to use with ensure_equals()
must have operator<<(std::ostream&, datatype) declared BEFORE lltut.h
#includes tut.hpp. Reorder code in certain test source files to guarantee that
visibility.
parent 642c334e
No related branches found
No related tags found
No related merge requests found
...@@ -2148,9 +2148,9 @@ ...@@ -2148,9 +2148,9 @@
<key>archive</key> <key>archive</key>
<map> <map>
<key>hash</key> <key>hash</key>
<string>ff1ecca950d779721267ef854eb2d845</string> <string>253519023e73d03fcb3feb2f7a2a8835</string>
<key>url</key> <key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/tut_3p-update-tut/rev/295661/arch/Linux/installer/tut-2008.11.30-common-295661.tar.bz2</string> <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/tut_3p-update-tut/rev/295891/arch/Linux/installer/tut-2008.11.30-common-295891.tar.bz2</string>
</map> </map>
<key>name</key> <key>name</key>
<string>common</string> <string>common</string>
......
...@@ -37,29 +37,14 @@ ...@@ -37,29 +37,14 @@
// associated header // associated header
#include "../lldependencies.h" #include "../lldependencies.h"
// other Linden headers // other Linden headers
#include "../test/lltut.h"
using boost::assign::list_of;
#if LL_WINDOWS #if LL_WINDOWS
#pragma warning (disable : 4675) // "resolved by ADL" -- just as I want! #pragma warning (disable : 4675) // "resolved by ADL" -- just as I want!
#endif #endif
typedef LLDependencies<> StringDeps; /*****************************************************************************
typedef StringDeps::KeyList StringList; * Display helpers: must be defined BEFORE lltut.h!
*****************************************************************************/
// We use the very cool boost::assign::list_of() construct to specify vectors
// of strings inline. For reasons on which I'm not entirely clear, though, it
// needs a helper function. You can use list_of() to construct an implicit
// StringList (std::vector<std::string>) by conversion, e.g. for a function
// parameter -- but if you simply write StringList(list_of("etc.")), you get
// ambiguity errors. Shrug!
template<typename CONTAINER>
CONTAINER make(const CONTAINER& data)
{
return data;
}
// Display an arbitary value as itself... // Display an arbitary value as itself...
template<typename T> template<typename T>
std::ostream& display(std::ostream& out, const T& value) std::ostream& display(std::ostream& out, const T& value)
...@@ -113,6 +98,31 @@ std::ostream& operator<<(std::ostream& out, const std::set<ENTRY>& set) ...@@ -113,6 +98,31 @@ std::ostream& operator<<(std::ostream& out, const std::set<ENTRY>& set)
return out; return out;
} }
/*****************************************************************************
* Now we can #include lltut.h
*****************************************************************************/
#include "../test/lltut.h"
/*****************************************************************************
* Other helpers
*****************************************************************************/
using boost::assign::list_of;
typedef LLDependencies<> StringDeps;
typedef StringDeps::KeyList StringList;
// We use the very cool boost::assign::list_of() construct to specify vectors
// of strings inline. For reasons on which I'm not entirely clear, though, it
// needs a helper function. You can use list_of() to construct an implicit
// StringList (std::vector<std::string>) by conversion, e.g. for a function
// parameter -- but if you simply write StringList(list_of("etc.")), you get
// ambiguity errors. Shrug!
template<typename CONTAINER>
CONTAINER make(const CONTAINER& data)
{
return data;
}
const std::string& extract_key(const LLDependencies<>::value_type& entry) const std::string& extract_key(const LLDependencies<>::value_type& entry)
{ {
return entry.first; return entry.first;
......
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
*/ */
#include "linden_common.h" #include "linden_common.h"
#include "../test/lltut.h"
#include <boost/assign/list_of.hpp> #include <boost/assign/list_of.hpp>
#include "../llstring.h" #include "../llstring.h"
#include "StringVec.h" #include "StringVec.h" // must come BEFORE lltut.h
#include "../test/lltut.h"
using boost::assign::list_of; using boost::assign::list_of;
......
...@@ -488,7 +488,7 @@ namespace tut ...@@ -488,7 +488,7 @@ namespace tut
template<> template<> template<> template<>
void lllogininstance_object::test<3>() void lllogininstance_object::test<3>()
{ {
skip(); skip("test fails with Xcode 6, skipping");
set_test_name("Test Mandatory Update User Accepts"); set_test_name("Test Mandatory Update User Accepts");
...@@ -517,7 +517,7 @@ namespace tut ...@@ -517,7 +517,7 @@ namespace tut
template<> template<> template<> template<>
void lllogininstance_object::test<4>() void lllogininstance_object::test<4>()
{ {
skip(); skip("test fails with Xcode 6, skipping");
set_test_name("Test Mandatory Update User Decline"); set_test_name("Test Mandatory Update User Decline");
......
...@@ -38,14 +38,14 @@ ...@@ -38,14 +38,14 @@
namespace tut namespace tut
{ {
void ensure_equals(const char* msg, const LLDate& actual, void ensure_equals(const std::string& msg, const LLDate& actual,
const LLDate& expected) const LLDate& expected)
{ {
ensure_equals(msg, ensure_equals(msg,
actual.secondsSinceEpoch(), expected.secondsSinceEpoch()); actual.secondsSinceEpoch(), expected.secondsSinceEpoch());
} }
void ensure_equals(const char* msg, const LLURI& actual, void ensure_equals(const std::string& msg, const LLURI& actual,
const LLURI& expected) const LLURI& expected)
{ {
ensure_equals(msg, ensure_equals(msg,
...@@ -61,18 +61,12 @@ namespace tut ...@@ -61,18 +61,12 @@ namespace tut
// if the LLSD::Binary type ever diverges from what we expect in lltut.h, // if the LLSD::Binary type ever diverges from what we expect in lltut.h,
// that divergence will produce an error: no definition will match that // that divergence will produce an error: no definition will match that
// declaration. // declaration.
void ensure_equals(const char* msg,
const LLSD::Binary& actual, const LLSD::Binary& expected)
{
ensure_equals(std::string(msg? msg : ""), actual, expected);
}
void ensure_equals(const std::string& msg, void ensure_equals(const std::string& msg,
const LLSD::Binary& actual, const LLSD::Binary& expected) const LLSD::Binary& actual, const LLSD::Binary& expected)
{ {
ensure_equals(msg + " size", actual.size(), expected.size()); ensure_equals(msg + " size", actual.size(), expected.size());
std::vector<U8>::const_iterator i, j; LLSD::Binary::const_iterator i, j;
int k; int k;
for (i = actual.begin(), j = expected.begin(), k = 0; for (i = actual.begin(), j = expected.begin(), k = 0;
i != actual.end(); i != actual.end();
...@@ -82,12 +76,6 @@ namespace tut ...@@ -82,12 +76,6 @@ namespace tut
} }
} }
void ensure_equals(const char* m, const LLSD& actual,
const LLSD& expected)
{
ensure_equals(std::string(m? m : ""), actual, expected);
}
void ensure_equals(const std::string& msg, const LLSD& actual, void ensure_equals(const std::string& msg, const LLSD& actual,
const LLSD& expected) const LLSD& expected)
{ {
......
...@@ -38,35 +38,24 @@ class LLURI; ...@@ -38,35 +38,24 @@ class LLURI;
namespace tut namespace tut
{ {
template <class T,class Q>
void ensure_equals(const std::string& msg, void ensure_equals(const std::string& msg,
const Q& actual,const T& expected)
{ ensure_equals(msg.c_str(), actual, expected); }
void ensure_equals(const char* msg,
const LLDate& actual, const LLDate& expected); const LLDate& actual, const LLDate& expected);
void ensure_equals(const char* msg, void ensure_equals(const std::string& msg,
const LLURI& actual, const LLURI& expected); const LLURI& actual, const LLURI& expected);
// std::vector<U8> is the current definition of LLSD::Binary. Because // std::vector<U8> is the current definition of LLSD::Binary. Because
// we're only forward-declaring LLSD in this header file, we can't // we're only forward-declaring LLSD in this header file, we can't
// directly reference that nested type. If the build complains that // directly reference that nested type. If the build complains that
// there's no definition for either of these declarations, it could be // there's no definition for this declaration, it could be that
// that LLSD::Binary has changed, and that these declarations must be // LLSD::Binary has changed, and that this declaration must be adjusted to
// adjusted to match. // match.
void ensure_equals(const char* msg,
const std::vector<U8>& actual, const std::vector<U8>& expected);
void ensure_equals(const std::string& msg, void ensure_equals(const std::string& msg,
const std::vector<U8>& actual, const std::vector<U8>& expected); const std::vector<U8>& actual, const std::vector<U8>& expected);
void ensure_equals(const char* msg,
const LLSD& actual, const LLSD& expected);
void ensure_equals(const std::string& msg, void ensure_equals(const std::string& msg,
const LLSD& actual, const LLSD& expected); const LLSD& actual, const LLSD& expected);
void ensure_starts_with(const std::string& msg, void ensure_starts_with(const std::string& msg,
const std::string& actual, const std::string& expectedStart); const std::string& actual, const std::string& expectedStart);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment