-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.c
More file actions
39 lines (32 loc) · 656 Bytes
/
Copy pathtest.c
File metadata and controls
39 lines (32 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "amp.h"
int
main(){
char *args[] = { "some", "stuff", "here" };
// encode
char *buf = amp_encode(args, 3);
// header
amp_t msg = {0};
amp_decode(&msg, buf);
assert(1 == msg.version);
assert(3 == msg.argc);
// args
for (int i = 0; i < msg.argc; ++i) {
char *arg = amp_decode_arg(&msg);
switch (i) {
case 0:
assert(0 == strcmp("some", arg));
break;
case 1:
assert(0 == strcmp("stuff", arg));
break;
case 2:
assert(0 == strcmp("here", arg));
break;
}
}
printf("ok\n");
return 0;
}