/* usage: * t_res_database <res database info file> */ int main(int argc, char *argv[]) { if(argc != 2) return 1; std::string rifo_url(argv[1]); if(rifo_url.rfind(".rifo") != rifo_url.length() + 1 - sizeof(".rifo")) { std::cerr << "incorrect parameter, expecting .rifo file" << std::endl; return 1; } DictInfo dict_info; if (!dict_info.load_from_ifo_file(rifo_url, DictInfoType_ResDb)) return 1; gulong filecount = dict_info.get_filecount(); gulong indexfilesize = dict_info.get_index_file_size(); std::unique_ptr<rindex_file> pindex; std::string base_url = rifo_url.substr(0, rifo_url.length() + 1 - sizeof(".rifo")); std::string ridx_url = base_url + ".ridx"; index_type_t index_type; if(g_file_test(ridx_url.c_str(), G_FILE_TEST_EXISTS)) { pindex.reset(new offset_rindex); index_type = itRidx; } else { ridx_url = base_url + ".ridx.gz"; if(g_file_test(ridx_url.c_str(), G_FILE_TEST_EXISTS)) { pindex.reset(new compressed_rindex); index_type = itRidxGz; } else { std::cerr << "index file not found" << std::endl; return 1; } } if(!pindex->load(ridx_url, filecount, indexfilesize, false)) { std::cerr << "unable to load index: " << ridx_url << std::endl; return 1; } index_vect_t index_vect; if(!load_index(ridx_url, index_vect, indexfilesize, filecount, index_type)) { std::cerr << "unable to read index: " << ridx_url << std::endl; return 1; } if(!lookup_test(index_vect, pindex.get())) { std::cerr << "test failed" << std::endl; return 1; } std::cout << "test passed" << std::endl; return 0; }
Test(av_full_table, lookup) { lookup_test(); }
Test(av_full_map, lookup) { lookup_test(); }