1 #include "config.h"
2 
3 #include <iostream>
4 #include <string>
5 #include <cassert>
6 
7 #ifdef HAVE_UNISTD_H
8 #include <unistd.h>
9 #endif
10 
11 #include <errno.h>
12 
13 #include "asserts.h"
14 #include "types.h"
15 #include "error.h"
16 #include "estring.h"
17 #include "fs.h"
18 #include "tstamp.h"
19 #include "rconfig.h"
20 #include "test-rconfig-setup.h"
21 
22 #define ERR_OUT(e) std::cerr << e;
23 // #define ERR_OUT(e)
24 
test(void)25 void test(void)
26 {
27 	char const * argv[256] = { 0 };
28 	int argc = 0;
29 	bool thrown = false;
30 
31 	argv[argc++] = "<program>";
32 	argv[argc++] = "--archive";
33 
34 	config.default_file("./test-rconfig.dir/global-timestamp-resolution.dir/file-1.conf");
35 	config.default_logdir("./test-rconfig.dir/log.dir");
36 	try {
37 		config.init(argc, argv);
38 	}
39 	catch(error e) {
40 		ERR_OUT(e);
41 		thrown = true;
42 	}
43 	catch(...) {
44 		assert(0);
45 	}
46 	assert(!thrown);
47 	assert(config.timestamp_resolution() == timestamp::resolution_month);
48 }
49 
main(int argc,char const * argv[])50 int main(int argc, char const * argv[])
51 {
52 	cleanup();
53 	setup();
54 	try {
55 		test();
56 	}
57 	catch(error e) {
58 		std::cerr << e;
59 		assert(0);
60 	}
61 	catch(...) {
62 		std::cerr << err_unknown;
63 		assert(0);
64 	}
65 	cleanup();
66 	return(0);
67 }
68 
69