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
.wantsync
== 1);
33 assert(srv
.wal
.syncrate
== DEFAULT_FSYNC_MS
*1000000);
34 assert(srv
.user
== NULL
);
35 assert(srv
.wal
.dir
== NULL
);
36 assert(srv
.wal
.use
== 0);
56 assertf(0, "optparse failed to call exit");
68 assert(strcmp(srv
.port
, "1234") == 0);
80 assert(strcmp(srv
.addr
, "localhost") == 0);
93 assert(strcmp(srv
.addr
, "localhost") == 0);
104 optparse(&srv
, args
);
105 assert(job_data_size_limit
== 1234);
109 cttest_optz_more_than_max()
116 optparse(&srv
, args
);
117 assert(job_data_size_limit
== 1073741824);
128 optparse(&srv
, args
);
129 assert(srv
.wal
.filesize
== 1234);
140 optparse(&srv
, args
);
141 assert(srv
.wal
.syncrate
== 1234000000);
142 assert(srv
.wal
.wantsync
== 1);
154 optparse(&srv
, args
);
155 assert(srv
.wal
.wantsync
== 0);
166 optparse(&srv
, args
);
167 assert(strcmp(srv
.user
, "kr") == 0);
178 optparse(&srv
, args
);
179 assert(strcmp(srv
.wal
.dir
, "foo") == 0);
180 assert(srv
.wal
.use
== 1);
191 optparse(&srv
, args
);
192 assert(verbose
== 1);
204 optparse(&srv
, args
);
205 assert(verbose
== 2);
216 optparse(&srv
, args
);
217 assert(verbose
== 3);
228 optparse(&srv
, args
);
229 assert(verbose
== 2);
230 assert(srv
.wal
.wantsync
== 0);
231 assert(strcmp(srv
.user
, "kr") == 0);