Changeset 438


Ignore:
Timestamp:
Dec 15, 2005, 10:10:35 AM (17 years ago)
Author:
Markus Ringnér
Message:

Fixed the test for checking for unexpected characters in vector stream. Previously this what accepted, not anymore

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/vector_test.cc

    r341 r438  
    4848    ok=false;
    4949
    50   // checking that copy contrutor creates an independent object
     50  // checking that copy constructor creates an independent object
    5151  gslapi::vector vec2(vec);
    5252  if (vec.size()!=vec2.size())
     
    5757    ok=false;
    5858
    59   // checking that copy contrutor creates an independent object when
     59  // checking that copy constructor creates an independent object when
    6060  // copying a view
    6161  vec2=vec_view;
     
    111111    ok=false;
    112112
    113   // Checking that unexpected characters in a stream are skipped. When
    114   // file read is reimplemented to resemble C/C++ style this should
    115   // check something else or maybe nothing at all.
    116   std::string data5("data/vector5.data");
    117   check_file_access(data5);
    118   std::ifstream data_stream5(data5.c_str());
    119   vec=gslapi::vector(data_stream5);
    120   if (vec.size()!=8)
    121     ok=false;
    122113
    123114  // Checking that badly formatted files are not accepted, or at least
    124115  // throws an exception for the programmer to catch.
    125116  bool this_ok=false;
     117  // Checking that unexpected characters in a stream gives error.
     118  try {
     119    std::string data5("data/vector5.data");
     120    check_file_access(data5);
     121    std::ifstream data_stream5(data5.c_str());
     122    vec=gslapi::vector(data_stream5); // this will give an exception
     123  } catch (utility::IO_error& err) {
     124    if (print)
     125      std::cerr << err.what() << std::endl;
     126    this_ok=true; // good, exceoption thrown, test passed
     127  }
    126128  try {
    127129    std::string data("data/vector6.data");
    128130    check_file_access(data);
    129131    std::ifstream data_stream(data.c_str());
    130     vec=gslapi::vector(data_stream); // this will gove an exception
     132    vec=gslapi::vector(data_stream); // this will give an exception
    131133  } catch (utility::IO_error& err) {
    132134    if (print)
     
    141143    check_file_access(data);
    142144    std::ifstream data_stream(data.c_str());
    143     vec=gslapi::vector(data_stream); // this will gove an exception
     145    vec=gslapi::vector(data_stream); // this will give an exception
    144146  } catch (utility::IO_error& err) {
    145147    if (print)
Note: See TracChangeset for help on using the changeset viewer.