aboutsummaryrefslogtreecommitdiffstats
path: root/tutorial/chapter-8/test/test.c
blob: 1fef246854670eb1b543d7775db196f0b1f5f129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "lib.h"

#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
    if (argc > 2) {
        printf("usage: test [value]\n");
        return 1;
    }
    const char *expected = argc == 2 ? argv[1] : "Hello from library";
    if (strcmp(get_string(), expected) != 0) {
        printf("text differs\n");
        return 1;
    }
    return 0;
}