X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=tests%2Fstatic_sequence_gmr_chunk_test.cpp;fp=tests%2Fstatic_sequence_gmr_chunk_test.cpp;h=1cb656c7b849e9550e3bc0ca8c4bb35fbc636e98;hb=3fd4bcef236556c7f3bff1d2be8d3f4206245501;hp=0000000000000000000000000000000000000000;hpb=dc7a566a39187bfcea70737cda7278f858cd9842;p=SXSI%2Flibcds.git diff --git a/tests/static_sequence_gmr_chunk_test.cpp b/tests/static_sequence_gmr_chunk_test.cpp new file mode 100644 index 0000000..1cb656c --- /dev/null +++ b/tests/static_sequence_gmr_chunk_test.cpp @@ -0,0 +1,80 @@ +/* static_sequence_gmr_chunk_test.cpp + * Copyright (C) 2008, Francisco Claude, all rights reserved. + * + * static_sequence_gmr_chunk_test + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "static_sequence_tester.h" + +int main(int argc, char ** argv) { + if(argc!=6) { + cout << "Usage: " << argv[0] << " " << endl; + return 0; + } + stringstream ss; + ss << argv[3]; + uint samp; + ss >> samp; + stringstream ss2; + ss2 << argv[4]; + uint perm_samp; + ss2 >> perm_samp; + + uint * text; + uint n; + load(argv[1],&text,&n); + + static_bitsequence_builder * bmb; + if(string(argv[2])==string("b")) + bmb = new static_bitsequence_builder_brw32(samp); + else + bmb = new static_bitsequence_builder_rrr02(samp); + + static_permutation_builder * spb = new static_permutation_builder_mrrr(perm_samp,bmb); + static_sequence_builder * ssb = new static_sequence_builder_gmr_chunk(bmb, spb); + static_sequence * sseq = ssb->build(text,n); + + delete bmb; + delete ssb; + delete spb; + + sseq = savetest(argv[1], sseq); + if(string(argv[5])==string("t")) + test_static_sequence(text,n,sseq); + else + cout << "Size: " << sseq->size() << endl; + cout << "*************************************" << endl; + speed_access(sseq,text,n); + cout << "*************************************" << endl; + speed_rank(sseq,text,n); + cout << "*************************************" << endl; + speed_select(sseq,text,n); + + delete sseq; + delete [] text; +} +