Fix missing va_end()s
[ccan] / ccan / ntdb / test / run-tdb_errorstr.c
1 #include "ntdb-source.h"
2 #include "tap-interface.h"
3 #include "helprun-external-agent.h"
4
5 int main(int argc, char *argv[])
6 {
7         enum NTDB_ERROR e;
8         plan_tests(NTDB_ERR_RDONLY*-1 + 2);
9
10         for (e = NTDB_SUCCESS; e >= NTDB_ERR_RDONLY; e--) {
11                 switch (e) {
12                 case NTDB_SUCCESS:
13                         ok1(!strcmp(ntdb_errorstr(e),
14                                     "Success"));
15                         break;
16                 case NTDB_ERR_IO:
17                         ok1(!strcmp(ntdb_errorstr(e),
18                                     "IO Error"));
19                         break;
20                 case NTDB_ERR_LOCK:
21                         ok1(!strcmp(ntdb_errorstr(e),
22                                     "Locking error"));
23                         break;
24                 case NTDB_ERR_OOM:
25                         ok1(!strcmp(ntdb_errorstr(e),
26                                     "Out of memory"));
27                         break;
28                 case NTDB_ERR_EXISTS:
29                         ok1(!strcmp(ntdb_errorstr(e),
30                                     "Record exists"));
31                         break;
32                 case NTDB_ERR_EINVAL:
33                         ok1(!strcmp(ntdb_errorstr(e),
34                                     "Invalid parameter"));
35                         break;
36                 case NTDB_ERR_NOEXIST:
37                         ok1(!strcmp(ntdb_errorstr(e),
38                                     "Record does not exist"));
39                         break;
40                 case NTDB_ERR_RDONLY:
41                         ok1(!strcmp(ntdb_errorstr(e),
42                                     "write not permitted"));
43                         break;
44                 case NTDB_ERR_CORRUPT:
45                         ok1(!strcmp(ntdb_errorstr(e),
46                                     "Corrupt database"));
47                         break;
48                 }
49         }
50         ok1(!strcmp(ntdb_errorstr(e), "Invalid error code"));
51
52         return exit_status();
53 }