summaryrefslogtreecommitdiff
path: root/gentoobrowse-api/unittests/testMaintenance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gentoobrowse-api/unittests/testMaintenance.cpp')
-rw-r--r--gentoobrowse-api/unittests/testMaintenance.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/gentoobrowse-api/unittests/testMaintenance.cpp b/gentoobrowse-api/unittests/testMaintenance.cpp
index b90c659..0dc09c0 100644
--- a/gentoobrowse-api/unittests/testMaintenance.cpp
+++ b/gentoobrowse-api/unittests/testMaintenance.cpp
@@ -19,12 +19,12 @@ BOOST_FIXTURE_TEST_SUITE(maintenance, MaintenanceClientCombined)
const std::filesystem::path treeDir(binDir / "tree");
const std::filesystem::path fixturesDir(rootDir / "fixtures");
-void dumpDb(DB::ConnectionPtr db);
+static void dumpDb(const DB::ConnectionPtr & db);
void
-doRefreshPackageTree(DB::ConnectionPtr db, int64_t cats, int64_t devvcs, int64_t pkgs, int64_t ebs, int64_t ebus,
- int64_t ebas, int64_t pus, int64_t ug, int64_t ul, int64_t ugs, int64_t ugds, int64_t deps, int64_t rdeps,
- int64_t news, int64_t masks, int64_t ebuildMasks)
+doRefreshPackageTree(const DB::ConnectionPtr & db, int64_t cats, int64_t devvcs, int64_t pkgs, int64_t ebs,
+ int64_t ebus, int64_t ebas, int64_t pus, int64_t ug, int64_t ul, int64_t ugs, int64_t ugds, int64_t deps,
+ int64_t rdeps, int64_t news, int64_t masks, int64_t ebuildMasks)
{
dumpDb(db);
@@ -47,9 +47,9 @@ doRefreshPackageTree(DB::ConnectionPtr db, int64_t cats, int64_t devvcs, int64_t
}
void
-dumpDb(DB::ConnectionPtr db)
+dumpDb(const DB::ConnectionPtr & db)
{
-#if DUMBDB
+#if DUMPDB
db->execute("COPY gentoobrowse.categories TO '/tmp/categories.tsv'");
db->execute("COPY gentoobrowse.packages TO '/tmp/packages.tsv'");
db->execute("COPY gentoobrowse.ebuilds TO '/tmp/ebuilds.tsv'");
@@ -70,9 +70,9 @@ dumpDb(DB::ConnectionPtr db)
class M2 : public Gentoo::Service::Maintenance {
public:
- typedef std::map<std::filesystem::path, size_t> FileMap;
+ using FileMap = std::map<std::filesystem::path, size_t>;
- M2(const DB::ConnectionPoolPtr & d) : Gentoo::Service::Maintenance(d) { }
+ explicit M2(const DB::ConnectionPoolPtr & d) : Gentoo::Service::Maintenance(d) { }
void
applyDiffOfFolders(const std::filesystem::path & from, const std::filesystem::path & to) const
@@ -146,7 +146,7 @@ public:
};
#define BOOST_TEST_CONTEXT_VAR(VAR, EXPR) \
- BOOST_TEST_CONTEXT(#EXPR) for (auto VAR = EXPR, *__context__run = &VAR; __context__run; __context__run = NULL)
+ BOOST_TEST_CONTEXT(#EXPR) for (auto VAR = EXPR, *__context__run = &VAR; __context__run; __context__run = nullptr)
BOOST_AUTO_TEST_CASE(refreshPackageTree)
{
@@ -228,7 +228,7 @@ create_initial_commit(git_repository * repo)
BOOST_REQUIRE_EQUAL(0, git_repository_index(&index, repo));
BOOST_REQUIRE_EQUAL(0, git_index_write_tree(&tree_id, index));
BOOST_REQUIRE_EQUAL(0, git_tree_lookup(&tree, repo, &tree_id));
- BOOST_REQUIRE_EQUAL(0, git_commit_create_v(&commit_id, repo, "HEAD", sig, sig, NULL, "Initial commit", tree, 0));
+ BOOST_REQUIRE_EQUAL(0, git_commit_create_v(&commit_id, repo, "HEAD", sig, sig, nullptr, "Initial commit", tree, 0));
git_index_free(index);
git_tree_free(tree);
@@ -250,8 +250,8 @@ BOOST_AUTO_TEST_CASE(testUpdateGitRepository)
BOOST_REQUIRE_EQUAL(0, git_remote_create(&origin, repo, "origin", "http://git.randomdan.homeip.net/git/portage"));
git_remote_free(origin);
auto commitOid = create_initial_commit(repo);
- char commit[GIT_OID_HEXSZ + 1];
- git_oid_tostr(commit, GIT_OID_HEXSZ, &commitOid);
+ std::array<char, GIT_OID_HEXSZ + 1> commit {};
+ git_oid_tostr(commit.data(), commit.size(), &commitOid);
git_repository_free(repo);
git_libgit2_shutdown();
// Reference it
@@ -261,7 +261,7 @@ BOOST_AUTO_TEST_CASE(testUpdateGitRepository)
insRepo->bindParamS(1, testRepo.string());
insRepo->bindParamS(2, "origin");
insRepo->bindParamS(3, "master");
- insRepo->bindParamS(4, commit);
+ insRepo->bindParamS(4, commit.data());
insRepo->execute();
// Update