/* $Id$ Copyright (C) 2007 by The Regents of the University of California Redistribution of this file is permitted under the terms of the *GNU* Public License (*GPL*) Date: 04/08/2007 Author: Yiming Lu */ #include #include #include #include #include #include "filtertree.h" #include "../util/input.h" using namespace std; void testFilterTree() { unsigned t = 0; vector data; data.push_back("abc"); data.push_back("ac"); data.push_back("xyz"); FilterTree fSave(2, &data); fSave.build(); vector searchResSave; fSave.search("ab", 2, searchResSave); //search based on building index fSave.saveIndex("index_File"); FilterTree fLoad(&data, "index_File"); vector searchResLoad; fLoad.search("ab", 2, searchResLoad); //search based on loading index assert(searchResSave == searchResLoad); t++; vector searchCor; searchCor.push_back(0); searchCor.push_back(1); assert(searchCor == searchResSave); t++; cout << "filterTree (" << t << ")" << endl; } int main() { testFilterTree(); }