#include <iostream>␍␊ |
#include "csvpp.h"␍␊ |
␍␊ |
using namespace std;␍␊ |
␍␊ |
int main()␍␊ |
{␍␊ |
␉RowReader tmp;␍␊ |
␉stringstream ss;␍␊ |
␉ss << "field1,field2,field3\r\n123,234,345\r\n999,000,111\r\n";␍␊ |
␉ss >> tmp;␍␊ |
␉rowiterator it;␍␊ |
␉int row = 0;␍␊ |
␉while(ss >> tmp)␍␊ |
␉{␍␊ |
␉␉switch (row)␍␊ |
␉␉{␍␊ |
␉␉␉case 0:␍␊ |
␉␉␉␉if (tmp["field1"] != "123")␍␊ |
␉␉␉␉{␍␊ |
␉␉␉␉␉cerr << "Failed at row " << row << endl;␍␊ |
␉␉␉␉␉return 1;␍␊ |
␉␉␉␉}␍␊ |
␉␉␉␉break;␍␊ |
␉␉␉case 1:␍␊ |
␉␉␉␉if (tmp["field1"] != "999")␍␊ |
␉␉␉␉{␍␊ |
␉␉␉␉␉cerr << "Failed at row " << row << endl;␍␊ |
␉␉␉␉␉return 1;␍␊ |
␉␉␉␉}␍␊ |
␉␉␉␉break;␍␊ |
␉␉}␍␊ |
␉}␍␊ |
␉␍␊ |
␉cout << "All tests ran successfully" << endl;␍␊ |
return 0;␍␊ |
} |