summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/unittests/Jamfile.jam8
-rw-r--r--gentoobrowse-api/unittests/testDependAll.cpp30
2 files changed, 38 insertions, 0 deletions
diff --git a/gentoobrowse-api/unittests/Jamfile.jam b/gentoobrowse-api/unittests/Jamfile.jam
index e41a194..465160a 100644
--- a/gentoobrowse-api/unittests/Jamfile.jam
+++ b/gentoobrowse-api/unittests/Jamfile.jam
@@ -49,6 +49,14 @@ run
<library>testCommon
: testDepend ;
+explicit testDependAll ;
+run
+ testDependAll.cpp ../service/utils/fileUtils.cpp ../service/utils/ebuildCacheParser.cpp ../service/depend.cpp ../service/utils/lexer.cpp
+ : : :
+ <define>BOOST_TEST_DYN_LINK
+ <library>testCommon
+ : testDependAll ;
+
run
testNews.cpp ../service/utils/fileUtils.cpp ../service/news.cpp ../service/utils/lexer.cpp
: : :
diff --git a/gentoobrowse-api/unittests/testDependAll.cpp b/gentoobrowse-api/unittests/testDependAll.cpp
new file mode 100644
index 0000000..47c7363
--- /dev/null
+++ b/gentoobrowse-api/unittests/testDependAll.cpp
@@ -0,0 +1,30 @@
+#define BOOST_TEST_MODULE TestDependAll
+#include <boost/test/unit_test.hpp>
+
+#include <depend.h>
+#include <utils/ebuildCacheParser.h>
+#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/convenience.hpp>
+
+void
+testDependRange(const boost::optional<Gentoo::Utils::EbuildCacheParser::Range> & r)
+{
+ if (r) {
+ Portage::Utils::Depend::parse(r->first, r->second);
+ }
+}
+
+BOOST_AUTO_TEST_CASE( processAll )
+{
+ for (boost::filesystem::recursive_directory_iterator d("/usr/portage/metadata/md5-cache");
+ d != boost::filesystem::recursive_directory_iterator(); d++) {
+ if (boost::filesystem::is_regular_file(d->status())) {
+ BOOST_TEST_CHECKPOINT(*d);
+ Gentoo::Utils::EbuildCacheParser ecp(*d);
+ testDependRange(ecp.getRange("DEPEND"));
+ testDependRange(ecp.getRange("RDEPEND"));
+ testDependRange(ecp.getRange("PDEPEND"));
+ }
+ }
+}
+