6 void testi(int a, ...) {
10 expecti(va_arg(ap, int), 2);
11 expecti(va_arg(ap, int), 3);
12 expecti(va_arg(ap, int), 4);
13 expecti(va_arg(ap, int), 5);
18 void testf(float a, ...) {
23 expectf(va_arg(ap, float), 2.0f);
24 expectf(va_arg(ap, float), 4.0f);
25 expectf(va_arg(ap, float), 8.0f);
30 void testm(char *p, ...) {
34 expectstr(p, "hello world");
35 expectf (va_arg(ap, float), 3.14);
36 expecti (va_arg(ap, int), 1024);
37 expectstr(va_arg(ap, char *), "good bye world");
38 expecti (va_arg(ap, int), 2048);
43 char *format(char *fmt, ...) {
46 vsprintf(buffer, fmt, ap); // fuck yeah
52 expectstr(format(""), ""); // nothing
53 expectstr(format("%d", 10), "10");
55 format("%d,%.1f,%d,%.1f,%s", 1024, 3.14, 2048, 6.28, "hello world"),
56 "1024,3.1,2048,6.3,hello world"
62 testf(1.0f, 2.0f, 4.0f, 8.0f);
63 testm("hello world", 3.14, 1024, "good bye world", 2048);