00001 #include "config.h"
00002
00003 #include <iostream>
00004 #include <fstream>
00005 #include <iomanip>
00006 #include <string>
00007 #include <cassert>
00008
00009 #include "error.h"
00010 #include "fs.h"
00011 #include "vaulter.h"
00012 #include "test-vaulter-setup.h"
00013
00014 #define ERR_OUT(e) std::cerr << e
00015
00016
00017 void test_vaulter(void)
00018 {
00019 char const * argv[256] = { 0 };
00020 int argc = 0;
00021 bool thrown = false;
00022
00023 argv[argc++] = "<program>";
00024 argv[argc++] = "--archive";
00025 argv[argc++] = "--timestamp";
00026 argv[argc++] = "2003-09-23";
00027
00028 config.default_file("./test-vaulter.dir/file-1.conf");
00029 try {
00030 config.init(argc, argv);
00031 logger.init();
00032 vaulter.init();
00033 vaulter.select();
00034 logger.clear();
00035 assert(vaulter.vault() == "./test-vaulter.dir/group-1/vault-3");
00036 }
00037 catch(error e) {
00038 ERR_OUT(e);
00039 thrown = true;
00040 }
00041 catch(...) {
00042 ERR_OUT(err_unknown);
00043 assert(0);
00044 }
00045 assert(!thrown);
00046 }
00047
00048 int main(int argc, char const * argv[])
00049 {
00050 cleanup();
00051 setup();
00052 try {
00053 test_vaulter();
00054 }
00055 catch(error e) {
00056 std::cerr << e;
00057 assert(0);
00058 }
00059 catch(...) {
00060 std::cerr << err_unknown;
00061 assert(0);
00062 }
00063 cleanup();
00064 return(0);
00065 }
00066