int main(int argc, char **argv) { if (argc != 2) { printf("fcache filename\n"); return 0; } const char *name = argv[1]; FileCache fc; fc.loadMmap(name); fc.dump(); return 0; }
TEST_F(TestFileCache, AutodetectNewCache) { // Make a quick new cache file on disk. CacheManager cm; ASSERT_TRUE(cm.addEmptyEntry("test_entry")); string temp_dir; ASSERT_TRUE(makeTempDir(&temp_dir)); string cache_fn(temp_dir); cache_fn.append("/cache.dump"); ASSERT_TRUE(cm.saveCache(cache_fn)); // Now make sure this file-cache is in default mode. FileCache fc; FileCache::UseNewCache = false; fc.loadMmap(cache_fn.c_str(), 1); ASSERT_TRUE(fc.exists("test_entry")); }