blob: c7104d97785178a14ad43dc42fe84db8d3c3fb17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#define BOOST_TEST_MODULE TestMaintenanceBits
#include <boost/test/unit_test.hpp>
#include <maintenance/abstractFileProcessor.h>
BOOST_AUTO_TEST_CASE( match )
{
std::filesystem::path path { "metadata/md5-cache/app-admin/conky-1.10.6-r1" };
Gentoo::Service::PathParts pp { path.begin(), path.end() };
BOOST_REQUIRE_EQUAL(4, pp.size());
BOOST_CHECK_EQUAL("metadata", pp[0]);
BOOST_CHECK_EQUAL("md5-cache", pp[1]);
}
BOOST_AUTO_TEST_CASE( compose )
{
// std::filesystem composes slightly differently to boost::filesystem
// Specifically "/base" / "/sub"
// boost => "/base/sub"
// std => "/sub"
std::filesystem::path base {"/base"}, file {"file"};
std::string sub {"/sub"};
std::filesystem::path comp = base / std::filesystem::path(sub).lexically_relative("/") / file;
BOOST_CHECK_EQUAL("/base/sub/file", comp);
}
|