1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
// $Id: import6.cc 2845 2009-09-01 09:33:31Z rafi $
// Checks whether or not the import of import5 worked.
// Relies on test4.csv
#include <typeinfo>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
#include <key.h>
#include <crypt.h>
#include <structs.h>
#include <record.h>
#include <partdec.h>
#include <file.h>
#include "tests.h"
#ifdef ROUNDS
#undef ROUNDS
#endif
#define ROUNDS 200
int main (int, char**) {
#ifndef TESTS_VERBOSE
int stdout_redir_fd = open("/dev/null", O_WRONLY | O_APPEND);
dup2(stdout_redir_fd,STDOUT_FILENO);
#endif
std::cout << std::endl;
std::cout << " ==> Check if import5 worked" << std::endl;
try {
YAPET::Key key ("test4");
YAPET::File file ("test4.pet", key, false);
std::list<YAPET::PartDec> list = file.read (key);
if (list.size() != ROUNDS)
return 1;
std::list<YAPET::PartDec>::iterator it = list.begin();
for (int i = 0; it != list.end(); i++) {
check_record (*it, key, i);
it++;
}
} catch (std::exception& ex) {
std::cout << std::endl;
std::cout << typeid (ex).name() << ": " << ex.what() << std::endl;
return 1;
}
std::cout << std::endl;
return 0;
}
|