summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/unittests/testDependAll.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/gentoobrowse-api/unittests/testDependAll.cpp b/gentoobrowse-api/unittests/testDependAll.cpp
index 47c7363..5fe0364 100644
--- a/gentoobrowse-api/unittests/testDependAll.cpp
+++ b/gentoobrowse-api/unittests/testDependAll.cpp
@@ -1,5 +1,6 @@
#define BOOST_TEST_MODULE TestDependAll
#include <boost/test/unit_test.hpp>
+#include <boost/test/data/test_case.hpp>
#include <depend.h>
#include <utils/ebuildCacheParser.h>
@@ -7,24 +8,31 @@
#include <boost/filesystem/convenience.hpp>
void
-testDependRange(const boost::optional<Gentoo::Utils::EbuildCacheParser::Range> & r)
+testDependRange(const std::optional<std::string_view> & r)
{
if (r) {
- Portage::Utils::Depend::parse(r->first, r->second);
+ Portage::Utils::Depend::parse(*r);
}
}
-BOOST_AUTO_TEST_CASE( processAll )
+auto
+getFileList()
{
+ std::vector<boost::filesystem::path> paths;
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"));
+ paths.push_back(*d);
}
}
+ return paths;
+}
+
+BOOST_DATA_TEST_CASE( processAll, boost::unit_test::data::make(getFileList()), path )
+{
+ Gentoo::Utils::EbuildCacheParser ecp(path);
+ testDependRange(ecp.getRange("DEPEND"));
+ testDependRange(ecp.getRange("RDEPEND"));
+ testDependRange(ecp.getRange("PDEPEND"));
}