Changeset 1313


Ignore:
Timestamp:
May 19, 2008, 7:44:17 PM (13 years ago)
Author:
Peter
Message:

refs #330 for Matrix

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/utility_test.cc

    r1312 r1313  
    127127    suite.err() << "is<double>(\"1.23.2\") should return false\n";
    128128  if (!suite.add(!utility::is<int>("1.23")))
    129     suite.err() << "is<int>(\"1.23\") should return true\n";
     129    suite.err() << "is<int>(\"1.23\") should return false\n";
     130  if (!suite.add(!utility::is<int>("")))
     131    suite.err() << "is<int>(\"\") should return false\n";
    130132
    131133  {
  • trunk/yat/utility/Matrix.cc

    r1275 r1313  
    9898          break;
    9999       
    100         if(utility::is_double(element)) {
    101           v.push_back(atof(element.c_str()));
    102         }
    103         else if (!element.size() || utility::is_nan(element)) {
     100        if (!element.size())
    104101          v.push_back(std::numeric_limits<double>::quiet_NaN());
    105         }
    106102        else {
    107           std::stringstream ss("Warning: '");
    108           ss << element << "' is not accepted as a matrix element.";
    109           throw IO_error(ss.str());
     103          try {
     104            v.push_back(convert<double>(element));
     105          }
     106          catch (std::runtime_error& e) {
     107            std::stringstream ss(e.what());
     108            ss << "\nMatrix.cc: " << element
     109               << " is not accepted as a matrix element\n";
     110            throw IO_error(ss.str());
     111          }
    110112        }
    111113      }           
Note: See TracChangeset for help on using the changeset viewer.