dpkg (1.18.25) stretch; urgency=medium
[dpkg] / lib / dpkg / t / t-test.c
CommitLineData
1479465f
GJ
1/*
2 * libdpkg - Debian packaging suite library routines
3 * t-test.c - test suite self tests
4 *
5 * Copyright © 2009, 2014 Guillem Jover <guillem@debian.org>
6 *
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#include <config.h>
22#include <compat.h>
23
24#include <dpkg/test.h>
25
26TEST_ENTRY(test)
27{
28 test_plan(20);
29
30 test_pass(1);
31 test_fail(0);
32
33 test_skip("ignore test");
34
35 test_skip_block(1) {
36 test_pass(0);
37 test_pass(1);
38 }
39
40 test_todo(0, "unimplemented test", "failing test");
41
42 test_todo_block("unimplemented block") {
43 test_pass(0);
44 test_fail(1);
45 }
46
47 test_str("aaa", ==, "aaa");
48 test_str("aaa", <, "bbb");
49 test_str("ccc", >, "bbb");
50 test_str("ccc", !=, "bbb");
51
52 test_mem("aaa", ==, "aaa", 3);
53 test_mem("aaa", <, "bbb", 3);
54 test_mem("ccc", >, "bbb", 3);
55 test_mem("ccc", !=, "bbb", 3);
56
57 test_mem("abcd", ==, "abcd", 4);
58 test_mem("abcd", ==, "abcd", 5);
59 test_mem("ababcd", ==, "ababff", 4);
60 test_mem("ababcd", !=, "ababff", 6);
61}