15 got
= fmtalloc("hello, %s %d", "world", 5);
16 assertf(strcmp("hello, world 5", got
) == 0, "got \"%s\"", got
);
28 assert(strcmp(srv
.port
, Portdef
) == 0);
29 assert(srv
.addr
== NULL
);
30 assert(job_data_size_limit
== JOB_DATA_SIZE_LIMIT_DEFAULT
);
31 assert(srv
.wal
.filesize
== Filesizedef
);
32 assert(srv
.wal
.nocomp
== 0);
33 assert(srv
.wal
.wantsync
== 0);
34 assert(srv
.user
== NULL
);
35 assert(srv
.wal
.dir
== NULL
);
36 assert(srv
.wal
.use
== 0);
58 assertf(0, "optparse failed to call exit");
71 assert(strcmp(srv
.port
, "1234") == 0);
84 assert(strcmp(srv
.addr
, "localhost") == 0);
98 assert(strcmp(srv
.addr
, "localhost") == 0);
110 optparse(&srv
, args
);
111 assert(job_data_size_limit
== 1234);
123 optparse(&srv
, args
);
124 assert(srv
.wal
.filesize
== 1234);
137 optparse(&srv
, args
);
138 assert(srv
.wal
.nocomp
== 0);
150 optparse(&srv
, args
);
151 assert(srv
.wal
.nocomp
== 1);
163 optparse(&srv
, args
);
164 assert(srv
.wal
.syncrate
== 1234000000);
165 assert(srv
.wal
.wantsync
== 1);
178 optparse(&srv
, args
);
179 assert(srv
.wal
.wantsync
== 0);
191 optparse(&srv
, args
);
192 assert(strcmp(srv
.user
, "kr") == 0);
204 optparse(&srv
, args
);
205 assert(strcmp(srv
.wal
.dir
, "foo") == 0);
206 assert(srv
.wal
.use
== 1);
218 optparse(&srv
, args
);
219 assert(verbose
== 1);
232 optparse(&srv
, args
);
233 assert(verbose
== 2);
245 optparse(&srv
, args
);
246 assert(verbose
== 3);
258 optparse(&srv
, args
);
259 assert(verbose
== 2);
260 assert(srv
.wal
.nocomp
== 1);
261 assert(strcmp(srv
.user
, "kr") == 0);