00001 #include <iostream>
00002 #include <fstream>
00003 #include <string>
00004
00005 #include <stdio.h>
00006 #include <string.h>
00007
00008 #include "NSError.h"
00009
00010 using namespace std;
00011
00012 Logger slog;
00013
00014 int test(int f)
00015 {
00016 try {
00017 throw NoSuchGroupError("no such group");
00018 } catch(Error & e) {
00019 e.print();
00020 if (f)
00021 return -1;
00022 }
00023 return 0;
00024 }
00025
00026 int main(int argc, char *argv[])
00027 {
00028 int ef = 0;
00029
00030 cout << "cNSError:\n";
00031 if (test(0) != 0) {
00032 cout << "test1 failed\n";
00033 ef++;
00034 }
00035 if (test(1) != -1) {
00036 cout << "test1 failed\n";
00037 ef++;
00038 }
00039
00040 if (ef == 0) {
00041 cout << "cNSError: all tests succeeded\n";
00042 exit(0);
00043 } else {
00044 cout << "cNSError: " << ef << " tests failed\n";
00045 exit(-1);
00046 }
00047 }