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

« back to all changes in this revision

Viewing changes to tests/basic_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
 
 
27
#include <check.h>
 
28
 
 
29
#include <lasso/lasso.h>
 
30
 
 
31
 
 
32
START_TEST(test01_server_load_dump_empty_string)
 
33
{
 
34
        LassoServer *serverContext;
 
35
        serverContext = lasso_server_new_from_dump("");
 
36
        fail_unless(serverContext == NULL,
 
37
                        "serverContext was created from an empty string dump");
 
38
}
 
39
END_TEST
 
40
 
 
41
START_TEST(test02_server_load_dump_random_string)
 
42
{
 
43
        LassoServer *serverContext;
 
44
        serverContext = lasso_server_new_from_dump("foo");
 
45
        fail_unless(serverContext == NULL,
 
46
                        "serverContext was created from a fake dump");
 
47
}
 
48
END_TEST
 
49
 
 
50
START_TEST(test03_server_load_dump_random_xml)
 
51
{
 
52
        LassoServer *serverContext;
 
53
        serverContext = lasso_server_new_from_dump("<?xml version=\"1.0\"?><foo/>");
 
54
        fail_unless(serverContext == NULL,
 
55
                        "serverContext was created from fake (but valid XML) dump");
 
56
}
 
57
END_TEST
 
58
 
 
59
 
 
60
Suite*
 
61
basic_suite()
 
62
{
 
63
        Suite *s = suite_create("Basic");
 
64
        TCase *tc_server_load_dump_empty_string = tcase_create("Create server from empty string");
 
65
        TCase *tc_server_load_dump_random_string = tcase_create("Create server from random string");
 
66
        TCase *tc_server_load_dump_random_xml = tcase_create("Create server from random XML");
 
67
        suite_add_tcase(s, tc_server_load_dump_empty_string);
 
68
        suite_add_tcase(s, tc_server_load_dump_random_string);
 
69
        suite_add_tcase(s, tc_server_load_dump_random_xml);
 
70
        tcase_add_test(tc_server_load_dump_empty_string, test01_server_load_dump_empty_string);
 
71
        tcase_add_test(tc_server_load_dump_random_string, test02_server_load_dump_random_string);
 
72
        tcase_add_test(tc_server_load_dump_random_xml, test03_server_load_dump_random_xml);
 
73
        return s;
 
74
}
 
75