]> git.cworth.org Git - notmuch/blobdiff - test/ghost-report.cc
test: add test-binary to print the number of ghost messages
[notmuch] / test / ghost-report.cc
diff --git a/test/ghost-report.cc b/test/ghost-report.cc
new file mode 100644 (file)
index 0000000..3e1b07c
--- /dev/null
@@ -0,0 +1,14 @@
+#include <iostream>
+#include <cstdlib>
+#include <xapian.h>
+
+int main(int argc, char **argv) {
+
+    if (argc < 2) {
+       std::cerr << "usage: ghost-report xapian-dir" << std::endl;
+       exit(1);
+    }
+
+    Xapian::Database db(argv[1]);
+    std::cout << db.get_termfreq("Tghost") << std::endl;
+}