~ubuntu-branches/ubuntu/utopic/lasso/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/tests.c

  • Committer: Bazaar Package Importer
  • Author(s): Frederic Peters
  • Date: 2004-09-13 09:26:34 UTC
  • Revision ID: james.westby@ubuntu.com-20040913092634-01vdfl8j9cp94exa
Tags: upstream-0.4.1
ImportĀ upstreamĀ versionĀ 0.4.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Lasso library C unit tests
 
3
 *
 
4
 * Copyright (C) 2004 Entr'ouvert
 
5
 * http://lasso.entrouvert.org
 
6
 *
 
7
 * Author: Emmanuel Raviart <eraviart@entrouvert.com>
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; either version 2 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
 */
 
23
 
 
24
#include <stdlib.h>
 
25
#include <string.h>
 
26
#include <lasso_config.h>
 
27
 
 
28
#include <check.h>
 
29
#include <lasso.h>
 
30
 
 
31
extern Suite* basic_suite();
 
32
extern Suite* login_suite();
 
33
 
 
34
typedef Suite* (*SuiteFunction) ();
 
35
 
 
36
SuiteFunction suites[] = {
 
37
        basic_suite,
 
38
        login_suite,
 
39
        NULL
 
40
};
 
41
 
 
42
int
 
43
main(int argc, char *argv[])
 
44
{
 
45
        int rc;
 
46
        SRunner *sr;
 
47
        int i;
 
48
        int dont_fork = 0;
 
49
 
 
50
        for (i=1; i<argc; i++) {
 
51
                if (strcmp(argv[i], "--dontfork") == 0) {
 
52
                        dont_fork = 1;
 
53
                }
 
54
        }
 
55
 
 
56
        lasso_init();
 
57
        
 
58
        sr = srunner_create(suites[0]());
 
59
 
 
60
        i = 1;
 
61
        while (suites[i]) {
 
62
                srunner_add_suite(sr, suites[i]());
 
63
                i++;
 
64
        }
 
65
 
 
66
        if (dont_fork) {
 
67
                srunner_set_fork_status(sr, CK_NOFORK);
 
68
        }
 
69
#ifdef CHECK_IS_XML
 
70
        srunner_set_xml(sr, "result.xml");
 
71
#endif
 
72
        srunner_run_all (sr, CK_VERBOSE);
 
73
        rc = srunner_ntests_failed(sr);
 
74
        
 
75
        srunner_free(sr);
 
76
        /*suite_free(s);  */
 
77
        /* no longer available in check 0.9.0; it will leak a
 
78
         * bit with previous versions */
 
79
 
 
80
        return (rc == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 
81
}
 
82