"Fossies" - the Fresh Open Source Software Archive

Member "cln-1.3.6/tests/test_I_io.cc" (18 Nov 2019, 700 Bytes) of package /linux/privat/cln-1.3.6.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "test_I_io.cc": 1.3.5_vs_1.3.6.

    1 #include "test_I.h"
    2 #include <cln/input.h>
    3 #include <sstream>
    4 
    5 int test_I_io (int iterations)
    6 {
    7     int error = 0;
    8     for (int i = iterations; i > 0; i--) {
    9         cl_I a = testrandom_I();
   10         unsigned base = iterations % (36-1) + 2;
   11         cl_read_flags rflags = {syntax_integer, lsyntax_standard, base};
   12         stringstream buf;
   13         print_integer(buf, base, a);
   14         cl_I b;
   15         try {
   16             b = read_integer(buf, rflags);
   17             ASSERT1(a == b, a);
   18         } catch (runtime_exception& err) {
   19             std::cerr << "Got an error while parsing \"" 
   20                 << buf.str() << "\" with base = " << base
   21                 << " (in decimal: " << a << ")" << std::endl;
   22             std::cerr << "Details: " << err.what() << std::endl;
   23             ++error;
   24             break;
   25         }
   26 
   27     }
   28     return error;
   29 }