Debian Codegraph @

tests/api/version.c

raw symbols SCIP
1 /*
2 * ProFTPD - FTP server testsuite
3 * Copyright (c) 2008-2011 The ProFTPD Project team
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
18 *
19 * As a special exemption, The ProFTPD Project team and other respective
20 * copyright holders give permission to link this program with OpenSSL, and
21 * distribute the resulting executable, without including the source code for
22 * OpenSSL in the source distribution.
23 */
24
25 /* Version API tests */
26
27 #include "tests.h"
28
29 START_TEST (version_get_module_api_number_test) {
30 unsigned long res;
31
32 res = pr_version_get_module_api_number();
33 ck_assert_msg(res != 0, "Expected value, got zero");
34 ck_assert_msg(res == PR_MODULE_API_VERSION, "Expected %d, got %lu",
35 PR_MODULE_API_VERSION, res);
36 }
37 END_TEST
38
39 START_TEST (version_get_number_test) {
40 unsigned long res;
41
42 res = pr_version_get_number();
43 ck_assert_msg(res != 0, "Expected value, got zero");
44 ck_assert_msg(res == PROFTPD_VERSION_NUMBER, "Expected %d, got %lu",
45 PROFTPD_VERSION_NUMBER, res);
46 }
47 END_TEST
48
49 START_TEST (version_get_str_test) {
50 const char *res;
51
52 res = pr_version_get_str();
53 ck_assert_msg(res != NULL, "Expected string, got null");
54 ck_assert_msg(strcmp(res, PROFTPD_VERSION_TEXT) == 0, "Expected '%s', '%s'",
55 PROFTPD_VERSION_TEXT, res);
56 }
57 END_TEST
58
59 Suite *tests_get_version_suite(void) {
60 Suite *suite;
61 TCase *testcase;
62
63 suite = suite_create("version");
64 testcase = tcase_create("base");
65
66 tcase_add_test(testcase, version_get_module_api_number_test);
67 tcase_add_test(testcase, version_get_number_test);
68 tcase_add_test(testcase, version_get_str_test);
69
70 suite_add_tcase(suite, testcase);
71 return suite;
72 }