aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-17 23:48:38 -0400
committerGravatar Chris Xiong <chirs241097@gmail.com> 2022-09-17 23:48:38 -0400
commit04f509fd948c03c8b8732ddb6787eea800bdc7f6 (patch)
treec82f4c00cd29f42b23066d8bb5123fa0b17a6e7b /tests
parentc684f2433cfe65e93d6ff31ae82e98644964520b (diff)
downloaddeduper-04f509fd948c03c8b8732ddb6787eea800bdc7f6.tar.xz
Finish similar image grouping.
Diffstat (limited to 'tests')
-rw-r--r--tests/testdrive_sqlite.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/testdrive_sqlite.cpp b/tests/testdrive_sqlite.cpp
index 3f1fe40..c9e9aad 100644
--- a/tests/testdrive_sqlite.cpp
+++ b/tests/testdrive_sqlite.cpp
@@ -226,6 +226,9 @@ int main(int argc,char** argv)
};
sdb->populate(files, pcfg);
+ puts("grouping similar images...");
+ sdb->group_similar();
+
std::vector<dupe_t> dupes = sdb->dupe_pairs();
for (auto &p : dupes)
{
@@ -238,6 +241,24 @@ int main(int argc,char** argv)
printf("%s %s %f\n", p1.c_str(), p2.c_str(), p.distance);
#endif
}
+
+ std::vector<std::vector<size_t>> gp = sdb->groups_get();
+ for (auto gi = gp.begin(); gi != gp.end(); ++gi)
+ {
+ if (gi->size() < 2) continue;
+ printf("group #%lu:\n", gi - gp.begin());
+ for (auto &id : *gi)
+ {
+ fs::path p;
+ std::tie(p, std::ignore) = sdb->get_signature(id);
+#if PATH_VALSIZE == 2
+ wprintf(L"\t%ls\n", p.c_str());
+#else
+ printf("\t%s\n", p.c_str());
+#endif
+ }
+ }
+
sdb->to_db_file("test.sigdb");
delete sdb;
return 0;