[Debtags-commits] [svn] r1720 - in tagcoll/2.0: . tagcoll
tagcoll/tests
Enrico Zini
enrico at costa.debian.org
Tue May 9 00:15:23 UTC 2006
Author: enrico
Date: Tue May 9 00:15:22 2006
New Revision: 1720
Modified:
tagcoll/2.0/ (props changed)
tagcoll/2.0/tagcoll/BasicStringDiskIndex.cc
tagcoll/2.0/tagcoll/CardinalityStore.cc
tagcoll/2.0/tagcoll/Consumer.cc
tagcoll/2.0/tagcoll/DerivedTags.cc
tagcoll/2.0/tagcoll/Expression.cc
tagcoll/2.0/tagcoll/Implications.cc
tagcoll/2.0/tagcoll/InputMerger.cc
tagcoll/2.0/tagcoll/IntDiskIndex.cc
tagcoll/2.0/tagcoll/IntIndex.cc
tagcoll/2.0/tagcoll/MMapIndex.cc
tagcoll/2.0/tagcoll/PatchCollection.cc
tagcoll/2.0/tagcoll/Patches.cc
tagcoll/2.0/tagcoll/Serializer.cc
tagcoll/2.0/tagcoll/SmartHierarchy.cc
tagcoll/2.0/tagcoll/StringIndex.cc
tagcoll/2.0/tagcoll/TDBIndexer.cc
tagcoll/2.0/tagcoll/TextFormat.cc
tagcoll/2.0/tagcoll/experiments.cc
tagcoll/2.0/tagcoll/filters.cc
tagcoll/2.0/tagcoll/sink.cc
tagcoll/2.0/tagcoll/test-utils.cc
tagcoll/2.0/tagcoll/tests/test-utils.h
tagcoll/2.0/tagcoll/tests/tut-main.cpp
Log:
r2607 at viaza: enrico | 2006-05-07 15:26:20 -0500
Wibblified the tests
Modified: tagcoll/2.0/tagcoll/BasicStringDiskIndex.cc
==============================================================================
--- tagcoll/2.0/tagcoll/BasicStringDiskIndex.cc (original)
+++ tagcoll/2.0/tagcoll/BasicStringDiskIndex.cc Tue May 9 00:15:22 2006
@@ -80,8 +80,9 @@
#include <sys/stat.h>
#include <sys/types.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
using namespace std;
#include <iostream>
@@ -145,6 +146,7 @@
}
}
+}
#endif
// vim:set ts=4 sw=4:
Modified: tagcoll/2.0/tagcoll/CardinalityStore.cc
==============================================================================
--- tagcoll/2.0/tagcoll/CardinalityStore.cc (original)
+++ tagcoll/2.0/tagcoll/CardinalityStore.cc Tue May 9 00:15:22 2006
@@ -678,8 +678,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_cardinalitystore_shar {
};
@@ -703,6 +704,7 @@
}
}
+}
#endif
// vim:set ts=4 sw=4:
Modified: tagcoll/2.0/tagcoll/Consumer.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Consumer.cc (original)
+++ tagcoll/2.0/tagcoll/Consumer.cc Tue May 9 00:15:22 2006
@@ -32,8 +32,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_consumer_shar {
};
@@ -69,6 +70,7 @@
}
}
+}
// vim:set ts=4 sw=4:
#endif
Modified: tagcoll/2.0/tagcoll/DerivedTags.cc
==============================================================================
--- tagcoll/2.0/tagcoll/DerivedTags.cc (original)
+++ tagcoll/2.0/tagcoll/DerivedTags.cc Tue May 9 00:15:22 2006
@@ -40,8 +40,9 @@
#include <tagcoll/InputMerger.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_derivedtags_shar {
};
@@ -72,9 +73,9 @@
parseCollection(input_coll, addDerived(derivations, consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -101,12 +102,13 @@
parseCollection(input_coll, removeDerived(derivations, consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
}
+}
#include <tagcoll/TextFormat.tcc>
Modified: tagcoll/2.0/tagcoll/Expression.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Expression.cc (original)
+++ tagcoll/2.0/tagcoll/Expression.cc Tue May 9 00:15:22 2006
@@ -209,8 +209,9 @@
#include <tagcoll/InputMerger.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_expression_shar {
};
@@ -225,34 +226,34 @@
test.insert("sugar");
Expression e1("coffee");
- gen_ensure(e1(test));
+ ensure(e1(test));
Expression e2("coffee && tea");
- gen_ensure(e2(test));
+ ensure(e2(test));
e1 = Expression("!coffee");
- gen_ensure(!e1(test));
+ ensure(!e1(test));
e1 = Expression("coffee || milk");
- gen_ensure(e1(test));
+ ensure(e1(test));
e1 = Expression("coffee && !milk");
- gen_ensure(e1(test));
+ ensure(e1(test));
e1 = Expression("coffee && !tea");
- gen_ensure(!e1(test));
+ ensure(!e1(test));
e1 = Expression("(coffee || milk) && (tea && sugar)");
- gen_ensure(e1(test));
+ ensure(e1(test));
e1 = Expression("!(coffee && milk) && (tea && sugar)");
- gen_ensure(e1(test));
+ ensure(e1(test));
std::set<string> test1;
test1.insert("coffee");
test1.insert("milk");
Expression e3("coffee && milk && !sugar");
- gen_ensure(e3(test1));
+ ensure(e3(test1));
}
template<> template<>
@@ -273,9 +274,9 @@
"(*::D && e::F) || c", consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -297,12 +298,13 @@
"*::D || e::F || c", ExpressionFilter::PLAIN, consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
}
+}
#include <tagcoll/TextFormat.tcc>
Modified: tagcoll/2.0/tagcoll/Implications.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Implications.cc (original)
+++ tagcoll/2.0/tagcoll/Implications.cc Tue May 9 00:15:22 2006
@@ -123,8 +123,9 @@
#include <tagcoll/InputMerger.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_implications_shar {
};
@@ -154,13 +155,13 @@
InputMerger<string, string> result;
Implications<string> implications;
- outputCollection(input_impl, implications);
+ parseCollection(input_impl, consumer(implications));
parseCollection(input_coll, addImplied(implications, consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -186,16 +187,17 @@
InputMerger<string, string> result;
Implications<string> implications;
- outputCollection(input_impl, implications);
+ parseCollection(input_impl, consumer(implications));
parseCollection(input_coll, removeImplied(implications, consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
}
+}
#include <tagcoll/TextFormat.tcc>
Modified: tagcoll/2.0/tagcoll/InputMerger.cc
==============================================================================
--- tagcoll/2.0/tagcoll/InputMerger.cc (original)
+++ tagcoll/2.0/tagcoll/InputMerger.cc Tue May 9 00:15:22 2006
@@ -189,8 +189,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_inputmerger_shar {
};
@@ -214,6 +215,7 @@
}
}
+}
#endif
Modified: tagcoll/2.0/tagcoll/IntDiskIndex.cc
==============================================================================
--- tagcoll/2.0/tagcoll/IntDiskIndex.cc (original)
+++ tagcoll/2.0/tagcoll/IntDiskIndex.cc Tue May 9 00:15:22 2006
@@ -496,8 +496,9 @@
#include <string>
#include <map>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
using namespace std;
static const char* fname = "tagcoll_intdiskindex.tmp";
@@ -530,35 +531,37 @@
string get(int val)
{
std::map<int, string>::const_iterator i = tostring.find(val);
- gen_ensure(i != tostring.end());
+ ensure(i != tostring.end());
return i->second;
}
};
}
+}
namespace tagcoll {
class TestFromIntConverter : public Converter<int, std::string>
{
- tut::BigMap& map;
+ wibble::tut::BigMap& map;
public:
- TestFromIntConverter(tut::BigMap& map) : map(map) {}
+ TestFromIntConverter(wibble::tut::BigMap& map) : map(map) {}
virtual std::string operator()(const int& item) const { return map.get(item); }
};
class TestToIntConverter : public Converter<std::string, int>
{
- tut::BigMap& map;
+ wibble::tut::BigMap& map;
public:
- TestToIntConverter(tut::BigMap& map) : map(map) {}
+ TestToIntConverter(wibble::tut::BigMap& map) : map(map) {}
virtual int operator()(const std::string& item) const { return map.get(item); }
};
}
+namespace wibble {
namespace tut {
struct tagcoll_intdiskindex_shar {
@@ -637,6 +640,7 @@
}
}
+}
#endif
// vim:set ts=4 sw=4:
Modified: tagcoll/2.0/tagcoll/IntIndex.cc
==============================================================================
--- tagcoll/2.0/tagcoll/IntIndex.cc (original)
+++ tagcoll/2.0/tagcoll/IntIndex.cc Tue May 9 00:15:22 2006
@@ -53,8 +53,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
static const char* fname = "tagcoll_intindex.tmp";
@@ -110,6 +111,7 @@
}
}
+}
#endif
// vim:set ts=4 sw=4:
Modified: tagcoll/2.0/tagcoll/MMapIndex.cc
==============================================================================
--- tagcoll/2.0/tagcoll/MMapIndex.cc (original)
+++ tagcoll/2.0/tagcoll/MMapIndex.cc Tue May 9 00:15:22 2006
@@ -191,8 +191,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
// Very simple test index
@@ -249,19 +250,20 @@
MasterMMapIndex master(fname);
TestIndex index1(master, 0);
- gen_ensure_equals(index1.size(), MMapIndex::align(6u));
- gen_ensure_equals(string(index1.get()), string("pippo"));
+ ensure_equals(index1.size(), MMapIndex::align(6u));
+ ensure_equals(string(index1.get()), string("pippo"));
TestIndex index2(master, 1);
- gen_ensure_equals(index2.size(), MMapIndex::align(6u));
- gen_ensure_equals(string(index2.get()), string("pluto"));
+ ensure_equals(index2.size(), MMapIndex::align(6u));
+ ensure_equals(string(index2.get()), string("pluto"));
TestIndex index3(master, 2);
- gen_ensure_equals(index3.size(), MMapIndex::align(9u));
- gen_ensure_equals(string(index3.get()), string("paperino"));
+ ensure_equals(index3.size(), MMapIndex::align(9u));
+ ensure_equals(string(index3.get()), string("paperino"));
}
}
+}
#endif
Modified: tagcoll/2.0/tagcoll/PatchCollection.cc
==============================================================================
--- tagcoll/2.0/tagcoll/PatchCollection.cc (original)
+++ tagcoll/2.0/tagcoll/PatchCollection.cc Tue May 9 00:15:22 2006
@@ -245,8 +245,9 @@
#include <tests/test-utils.h>
#include <tagcoll/InputMerger.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_patchcollection_shar {
};
@@ -276,6 +277,7 @@
}
}
+}
#include <tagcoll/Patches.tcc>
Modified: tagcoll/2.0/tagcoll/Patches.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Patches.cc (original)
+++ tagcoll/2.0/tagcoll/Patches.cc Tue May 9 00:15:22 2006
@@ -30,8 +30,9 @@
#include <tests/test-utils.h>
#include <tagcoll/InputMerger.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
using namespace wibble::operators;
struct tagcoll_patches_shar {
@@ -74,11 +75,12 @@
parseCollection(input_coll, patcher(patches, consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
+}
}
#include <tagcoll/TextFormat.tcc>
Modified: tagcoll/2.0/tagcoll/Serializer.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Serializer.cc (original)
+++ tagcoll/2.0/tagcoll/Serializer.cc Tue May 9 00:15:22 2006
@@ -51,8 +51,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_serializer_shar {
};
@@ -64,15 +65,16 @@
TrivialConverter<string, string> sconv;
TrivialConverter<int, int> iconv;
- gen_ensure_equals(sconv("cippo lippo"), "cippo lippo");
- gen_ensure_equals(sconv("ciao"), "ciao");
- gen_ensure_equals(sconv(""), "");
- gen_ensure_equals(iconv(0), 0);
- gen_ensure_equals(iconv(30), 30);
- gen_ensure_equals(iconv(-30), -30);
+ ensure_equals(sconv("cippo lippo"), "cippo lippo");
+ ensure_equals(sconv("ciao"), "ciao");
+ ensure_equals(sconv(""), "");
+ ensure_equals(iconv(0), 0);
+ ensure_equals(iconv(30), 30);
+ ensure_equals(iconv(-30), -30);
}
}
+}
#endif
Modified: tagcoll/2.0/tagcoll/SmartHierarchy.cc
==============================================================================
--- tagcoll/2.0/tagcoll/SmartHierarchy.cc (original)
+++ tagcoll/2.0/tagcoll/SmartHierarchy.cc Tue May 9 00:15:22 2006
@@ -220,8 +220,9 @@
#include <tagcoll/TextFormat.h>
#include <tagcoll/StringParserInput.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_smarthierarchy_shar {
};
@@ -240,6 +241,7 @@
}
}
+}
#endif
Modified: tagcoll/2.0/tagcoll/StringIndex.cc
==============================================================================
--- tagcoll/2.0/tagcoll/StringIndex.cc (original)
+++ tagcoll/2.0/tagcoll/StringIndex.cc Tue May 9 00:15:22 2006
@@ -114,8 +114,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
static const char* fname = "tagcoll_stringindex.tmp";
@@ -175,6 +176,7 @@
}
}
+}
#endif
// vim:set ts=4 sw=4:
Modified: tagcoll/2.0/tagcoll/TDBIndexer.cc
==============================================================================
--- tagcoll/2.0/tagcoll/TDBIndexer.cc (original)
+++ tagcoll/2.0/tagcoll/TDBIndexer.cc Tue May 9 00:15:22 2006
@@ -140,8 +140,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_tdbindexer_shar {
};
@@ -165,6 +166,7 @@
}
}
+}
#endif
// vim:set ts=4 sw=4:
Modified: tagcoll/2.0/tagcoll/TextFormat.cc
==============================================================================
--- tagcoll/2.0/tagcoll/TextFormat.cc (original)
+++ tagcoll/2.0/tagcoll/TextFormat.cc Tue May 9 00:15:22 2006
@@ -161,8 +161,9 @@
#include <tagcoll/StringParserInput.h>
#include <tagcoll/Patches.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_textformat_shar {
};
@@ -181,8 +182,8 @@
TestConsumer<string, string> cons;
textformat::parse(coll, consumer(cons));
- gen_ensure_equals(cons.items, 4);
- gen_ensure_equals(cons.tags, 5);
+ ensure_equals(cons.items, 4);
+ ensure_equals(cons.tags, 5);
}
template<> template<>
@@ -207,22 +208,23 @@
i->second.getRemoved().size() << endl;
*/
- gen_ensure_equals(plist.size(), 2u);
- gen_ensure(plist.find("a") != plist.end());
- gen_ensure(plist.find("b") == plist.end());
- gen_ensure(plist.find("c") == plist.end());
- gen_ensure(plist.find("d") != plist.end());
+ ensure_equals(plist.size(), 2u);
+ ensure(plist.find("a") != plist.end());
+ ensure(plist.find("b") == plist.end());
+ ensure(plist.find("c") == plist.end());
+ ensure(plist.find("d") != plist.end());
PatchList<string, string>::const_iterator i = plist.find("a");
- gen_ensure_equals(i->second.getAdded().size(), 2u);
- gen_ensure_equals(i->second.getRemoved().size(), 0u);
+ ensure_equals(i->second.getAdded().size(), 2u);
+ ensure_equals(i->second.getRemoved().size(), 0u);
i = plist.find("d");
- gen_ensure_equals(i->second.getAdded().size(), 1u);
- gen_ensure_equals(i->second.getRemoved().size(), 2u);
+ ensure_equals(i->second.getAdded().size(), 1u);
+ ensure_equals(i->second.getRemoved().size(), 2u);
}
}
+}
#include <tagcoll/TextFormat.tcc>
Modified: tagcoll/2.0/tagcoll/experiments.cc
==============================================================================
--- tagcoll/2.0/tagcoll/experiments.cc (original)
+++ tagcoll/2.0/tagcoll/experiments.cc Tue May 9 00:15:22 2006
@@ -409,8 +409,9 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_experiments_shar {
};
@@ -423,6 +424,7 @@
}
}
+}
#endif
Modified: tagcoll/2.0/tagcoll/filters.cc
==============================================================================
--- tagcoll/2.0/tagcoll/filters.cc (original)
+++ tagcoll/2.0/tagcoll/filters.cc Tue May 9 00:15:22 2006
@@ -27,8 +27,9 @@
#include <tagcoll/sink.h>
#include <tagcoll/InputMerger.h>
+namespace wibble {
namespace tut {
-using namespace tut_tagcoll;
+using namespace tagcoll::tests;
struct tagcoll_filters_shar {
};
@@ -60,9 +61,9 @@
parseCollection(input_coll, substitute(changes, consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -81,9 +82,9 @@
parseCollection(input_coll, untaggedRemover(consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -101,9 +102,9 @@
parseCollection(input_coll, untaggedRemover(consumer(result), true));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -123,9 +124,9 @@
parseCollection(input_coll, unfacetedRemover(consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -145,9 +146,9 @@
parseCollection(input_coll, unfacetedRemover(consumer(result), "---"));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -167,9 +168,9 @@
parseCollection(input_coll, itemsOnly(consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -190,9 +191,9 @@
parseCollection(input_coll, reverser(string("z"), consumer(result)));
InputMerger<string, string> reference;
- outputCollection(output_coll, reference);
+ parseCollection(output_coll, consumer(reference));
- gen_ensure_coll_equals(reference, result);
+ ensure_coll_equals(reference, result);
}
template<> template<>
@@ -208,11 +209,12 @@
parseCollection(input_coll, teeFilter(countingSink(count1), countingSink(count2)));
- gen_ensure_equals(count1, 3);
- gen_ensure_equals(count2, 3);
+ ensure_equals(count1, 3);
+ ensure_equals(count2, 3);
}
}
+}
#include <tagcoll/TextFormat.tcc>
Modified: tagcoll/2.0/tagcoll/sink.cc
==============================================================================
--- tagcoll/2.0/tagcoll/sink.cc (original)
+++ tagcoll/2.0/tagcoll/sink.cc Tue May 9 00:15:22 2006
@@ -24,6 +24,7 @@
#include <tests/test-utils.h>
+namespace wibble {
namespace tut {
using namespace tut_tagcoll;
@@ -42,10 +43,11 @@
int count = 0;
parseCollection(input_coll, countingSink(count));
- gen_ensure_equals(count, 3);
+ ensure_equals(count, 3);
}
}
+}
#include <tagcoll/TextFormat.tcc>
Modified: tagcoll/2.0/tagcoll/test-utils.cc
==============================================================================
--- tagcoll/2.0/tagcoll/test-utils.cc (original)
+++ tagcoll/2.0/tagcoll/test-utils.cc Tue May 9 00:15:22 2006
@@ -18,15 +18,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef INSTANTIATING_TEMPLATES
-#include <string>
-
-namespace tagcoll {
- //template class TextFormat<std::string, std::string>;
-}
-#endif
-
-
#ifdef COMPILE_TESTSUITE
#include <tests/test-utils.h>
@@ -36,19 +27,14 @@
#include <tagcoll/Patches.h>
#include <wibble/operators.h>
-namespace tut_tagcoll {
+namespace tagcoll {
+namespace tests {
using namespace std;
using namespace tagcoll;
using namespace wibble::operators;
-using namespace tut;
+using namespace wibble::tests;
-void _gen_ensure(const Location& loc, bool res)
-{
- if (!res)
- throw failure(loc.locstr());
-}
-
void outputCollection(const std::string& str, tagcoll::Consumer<string, string>& cons)
{
StringParserInput input(str);
@@ -90,7 +76,7 @@
f += "\n";
}
- throw failure(loc.msg(f));
+ throw wibble::tut::failure(loc.msg(f));
}
}
@@ -423,6 +409,7 @@
}
}
+}
#include <tagcoll/TextFormat.tcc>
#include <tagcoll/Patches.tcc>
Modified: tagcoll/2.0/tagcoll/tests/test-utils.h
==============================================================================
--- tagcoll/2.0/tagcoll/tests/test-utils.h (original)
+++ tagcoll/2.0/tagcoll/tests/test-utils.h Tue May 9 00:15:22 2006
@@ -3,7 +3,7 @@
* @author Peter Rockai (mornfall) <mornfall at danill.sk>
* @brief Utility functions for the unit tests
*/
-#include <tut.h>
+#include <wibble/tests.h>
#include <string>
@@ -14,25 +14,13 @@
#include <tagcoll/StringParserInput.h>
#include <tagcoll/TextFormat.h>
#endif
-/*
-#include <apt-front/cache.h>
-#include <apt-pkg/configuration.h>
-#include <apt-pkg/error.h>
-#include <apt-pkg/pkgsystem.h>
-#include <apt-pkg/init.h>
-#include <iostream>
-*/
-
-#define TESTGRP(name) \
-typedef test_group<name ## _shar> tg; \
-typedef tg::object to; \
-tg name ## _tg (#name);
+namespace tagcoll {
+namespace tests {
-namespace tut_tagcoll {
using namespace std;
using namespace tagcoll;
-using namespace tut;
+using namespace wibble::tests;
template<class ITEM, class TAG>
class TestConsumer : public tagcoll::Consumer<ITEM, TAG>
@@ -53,37 +41,9 @@
TestConsumer() : items(0), tags(0) {}
};
-class Location
-{
- string file;
- int line;
- string str;
- string testfile;
- int testline;
- string teststr;
-public:
- Location(const std::string& file, int line, const std::string& str)
- : file(file), line(line), str(str) {}
- Location(const Location& loc,
- const std::string& testfile, int testline, const std::string& str) :
- file(loc.file), line(loc.line), str(loc.str),
- testfile(testfile), testline(testline), teststr(str) {}
- string locstr() const
- {
- std::stringstream ss;
- ss << file << ":" << line << "(" << str << ")";
- if (!testfile.empty())
- ss << "[" << testfile << ":" << testline << "(" << teststr << ")]";
- ss << ": ";
- return ss.str();
- }
- string msg(const std::string m) const
- {
- return locstr() + ": " + m;
- }
-};
-
+#if 0
void outputCollection(const std::string& str, tagcoll::Consumer<string, string>& cons);
+#endif
template<typename OUT>
void parseCollection(const std::string& str, const OUT& out)
@@ -92,24 +52,7 @@
textformat::parse(input, out);
}
-#define gen_ensure(x) _gen_ensure(Location(__FILE__, __LINE__, #x), (x))
-#define inner_ensure(x) _gen_ensure(Location(loc, __FILE__, __LINE__, #x), (x))
-void _gen_ensure(const Location& loc, bool res);
-
-#define gen_ensure_equals(x, y) my_ensure_equals(Location(__FILE__, __LINE__, #x " == " #y), (x), (y))
-#define inner_ensure_equals(x, y) my_ensure_equals(Location(loc, __FILE__, __LINE__, #x " == " #y), (x), (y))
-template <class T,class Q>
-void my_ensure_equals(const Location& loc, const Q& actual, const T& expected)
-{
- if( expected != actual )
- {
- std::stringstream ss;
- ss << "expected " << expected << " actual " << actual;
- throw failure(loc.msg(ss.str()));
- }
-}
-
-#define gen_ensure_coll_equals(a, b) \
+#define ensure_coll_equals(a, b) \
__tc_ensure_coll_equals(Location(__FILE__, __LINE__, #a " == " #b), a, b)
#define inner_ensure_coll_equals(a, b) \
__tc_ensure_coll_equals(Location(loc, __FILE__, __LINE__, #a " == " #b), a, b)
@@ -117,7 +60,7 @@
const tagcoll::ReadonlyCollection<string, string>& c1,
const tagcoll::ReadonlyCollection<string, string>& c2);
-#define gen_ensure_contains(a, b) \
+#define ensure_contains(a, b) \
_ensure_contains(Location(__FILE__, __LINE__, #a " contains " #b), a, b)
#define inner_ensure_contains(a, b) \
_ensure_contains(Location(loc, __FILE__, __LINE__, #a " contains " #b), a, b)
@@ -136,7 +79,7 @@
ss << ", " << *i;
ss << " does not contain " << item;
- throw failure(loc.msg(ss.str()));
+ throw wibble::tut::failure(loc.msg(ss.str()));
}
}
@@ -159,7 +102,7 @@
ss << ", " << *i;
ss << " does not contain " << item;
- throw failure(loc.msg(ss.str()));
+ throw wibble::tut::failure(loc.msg(ss.str()));
}
}
@@ -181,6 +124,7 @@
#endif
}
+}
/*
namespace tut {
Modified: tagcoll/2.0/tagcoll/tests/tut-main.cpp
==============================================================================
--- tagcoll/2.0/tagcoll/tests/tut-main.cpp (original)
+++ tagcoll/2.0/tagcoll/tests/tut-main.cpp Tue May 9 00:15:22 2006
@@ -1,11 +1,13 @@
-#include <tut.h>
-#include <tut_reporter.h>
+#include <wibble/tests.h>
#include <signal.h>
-namespace tut
-{
+namespace wibble {
+namespace tut {
test_runner_singleton runner;
}
+}
+
+using namespace wibble;
void signal_to_exception(int)
{
More information about the Debtags-commits
mailing list