X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=libcds%2Ftests%2Ftext_to_int.cpp;fp=libcds%2Ftests%2Ftext_to_int.cpp;h=200fbdf4cb2e20a266b3e42eb2138a204f12a634;hb=52cb7bbcda67f4676335cdd4eb96d4d87ad1445d;hp=0000000000000000000000000000000000000000;hpb=950870fc762cf5c4d551db78bc798b540d893b4a;p=SXSI%2FXMLTree.git diff --git a/libcds/tests/text_to_int.cpp b/libcds/tests/text_to_int.cpp new file mode 100644 index 0000000..200fbdf --- /dev/null +++ b/libcds/tests/text_to_int.cpp @@ -0,0 +1,74 @@ +/* test_to_int.cpp + * Copyright (C) 2008, Francisco Claude, all rights reserved. + * + * text_to_int + * + * 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!=3) { + cout << "Usage: " << argv[0] << " " << endl; + return 0; + } + char * fname = argv[1]; + char * oname = argv[2]; + + FILE * fp = fopen(fname,"r"); + if(fp==NULL) { + cout << "could not open " << fname << endl; + return 1; + } + struct stat text_info; + if(stat(fname,&text_info)<0) { + cout << "could not stat: " << fname << endl; + return 1; + } + + uint n= (uint)text_info.st_size; + uint * text = new uint[n]; + + for(uint i=0;i