]> git.ozlabs.org Git - ccan/blob - ccan/tap/_info
tap: make examples compilable by ccanlint.
[ccan] / ccan / tap / _info
1 #include <stdio.h>
2 #include <string.h>
3 #include "config.h"
4
5 /**
6  * tap - Test Anything Protocol
7  *
8  * The tap package produces simple-to-parse mainly-human-readable test
9  * output to assist in the writing of test cases.  It is based on the
10  * (now-defunct) libtap, which is based on Perl's CPAN TAP module.  Its
11  * output can be parsed by a harness such as CPAN's Prove.
12  *
13  * CCAN testcases are expected to output the TAP format, usually using
14  * this package.
15  *
16  * For more information about TAP, see:
17  *      http://en.wikipedia.org/wiki/Test_Anything_Protocol
18  *
19  * Based on the original libtap, Copyright (c) 2004 Nik Clayton.
20  *
21  * Example:
22  *      #include <string.h>
23  *      #include <ccan/tap/tap.h>
24  *
25  *      // Run some simple (but overly chatty) tests on strcmp().
26  *      int main(int argc, char *argv[])
27  *      {
28  *              const char a[] = "a", another_a[] = "a";
29  *              const char b[] = "b";
30  *              const char ab[] = "ab";
31  *
32  *              plan_tests(4);
33  *              diag("Testing different pointers (%p/%p) with same contents",
34  *                   a, another_a);
35  *              ok1(strcmp(a, another_a) == 0);
36  *
37  *              diag("'a' comes before 'b'");
38  *              ok1(strcmp(a, b) < 0);
39  *              ok1(strcmp(b, a) > 0);
40  *
41  *              diag("'ab' comes after 'a'");
42  *              ok1(strcmp(ab, a) > 0);
43  *              return exit_status();
44  *      }
45  *
46  * Maintainer: Rusty Russell <rusty@rustcorp.com.au>
47  */
48 int main(int argc, char *argv[])
49 {
50         if (argc != 2)
51                 return 1;
52
53         if (strcmp(argv[1], "depends") == 0) {
54                 printf("ccan/compiler\n");
55                 return 0;
56         }
57
58         return 1;
59 }