~noskcaj/ubuntu/wily/gdm/3.16.2

« back to all changes in this revision

Viewing changes to tests/s-common-utils.c

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2014-11-10 13:26:33 UTC
  • mfrom: (1.4.58)
  • Revision ID: package-import@ubuntu.com-20141110132633-lyhncm9vorsvz3n6
Tags: 3.14.0-0ubuntu1
* New upstream release
* debian/control.in: 
  - depend on gnome-session 3.12.1 for DesktopNames
  - Add build-dep on dconf-cli (>= 0.19.90) for dconf compile
  - Bump build-dep on glib2.0 (>= 2.36.0)
* debian/rules: disable wayland support
* debian/patches:
  - 01_language.patch, ubuntu_export_XDG_CURRENT_DESKTOP.patch: Refreshed
  - 10_no_gettext.patch, 22_noconsole.patch: Dropped, included in new version
  - ubuntu_no_debug.patch, ubuntu_no_LANG_setting_in_Xsession.patch: Dropped
  - ubuntu_export_XDG_CURRENT_DESKTOP.patch: Dropped,
     this is provided upstream now via DesktopNames Property
  - ubuntu_upstart_event.patch: Don't emit upstart events
     when running systemd init 
  - revert_override_LANG_with_accountservices.patch:
     On Ubuntu accountservices only stores the language and not the
     full locale as needed by LANG.
* debian/gdm.init, gdm.upstart: update dconf update hooks /etc/dconf/profile/gdm
  is only required now when custom greeter settings exist
* debian/gdm.preinst: Remove obsolete dconf files
* debian/libgdm1.symbols: update for removed and 4 new symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2
 
 *
3
 
 * Copyright (C) 2007 Andrew Ziem <ahz001@gmail.com>
4
 
 * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
5
 
 *
6
 
 * This library is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU Library General Public
8
 
 * License as published by the Free Software Foundation; either
9
 
 * version 2 of the License, or (at your option) any later version.
10
 
 *
11
 
 * This library is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * Library General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU Library General Public
17
 
 * License along with this library; if not, write to the
18
 
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
 
 * Boston, MA 02110-1301, USA.
20
 
 */
21
 
 
22
 
#include <stdlib.h>
23
 
#include <string.h>
24
 
#include <glib.h>
25
 
 
26
 
#include "s-common-utils.h"
27
 
#include "gdm-common.h"
28
 
 
29
 
START_TEST (test_gdm_string_hex_encode)
30
 
{
31
 
        GString *a;
32
 
        GString *b;
33
 
 
34
 
        a = g_string_new ("foo");
35
 
        b = g_string_sized_new (100);
36
 
        fail_unless (TRUE == gdm_string_hex_encode (a, 0, b, 0), NULL);
37
 
        fail_unless (0 == strncmp (b->str, "666f6f", 7), NULL);
38
 
 
39
 
#ifndef NO_INVALID_INPUT
40
 
        /* invalid input */
41
 
        fail_unless (FALSE == gdm_string_hex_encode (a, -1, b, -1), NULL);
42
 
        fail_unless (FALSE == gdm_string_hex_encode (NULL, 0, NULL, 0), NULL);
43
 
        fail_unless (FALSE == gdm_string_hex_encode (a, 0, a, 0), NULL);
44
 
#endif
45
 
 
46
 
        g_string_free (a, TRUE);
47
 
        g_string_free (b, TRUE);
48
 
}
49
 
END_TEST
50
 
 
51
 
 
52
 
START_TEST (test_gdm_string_hex_decode)
53
 
        GString *a;
54
 
        GString *b;
55
 
 
56
 
        a = g_string_new ("666f6f");
57
 
        b = g_string_sized_new (100);
58
 
 
59
 
        fail_unless (TRUE == gdm_string_hex_decode (a, 0, NULL, b, 0), NULL);
60
 
 
61
 
        fail_unless (0 == strncmp (b->str, "foo", 7), NULL);
62
 
 
63
 
#ifndef NO_INVALID_INPUT
64
 
        /* invalid input */
65
 
        fail_unless (FALSE == gdm_string_hex_decode (a, -1, NULL, b, -1), NULL);
66
 
        fail_unless (FALSE == gdm_string_hex_decode (NULL, 0, NULL, NULL, 0), NULL);
67
 
        fail_unless (FALSE == gdm_string_hex_decode (a, 0, NULL, a, 0), NULL);
68
 
#endif
69
 
 
70
 
        g_string_free (a, TRUE);
71
 
        g_string_free (b, TRUE);
72
 
END_TEST
73
 
 
74
 
Suite *
75
 
suite_common_utils (void)
76
 
{
77
 
        Suite *s;
78
 
        TCase *tc_core;
79
 
 
80
 
        s = suite_create ("gdm-common");
81
 
        tc_core = tcase_create ("core");
82
 
 
83
 
        tcase_add_test (tc_core, test_gdm_string_hex_encode);
84
 
        tcase_add_test (tc_core, test_gdm_string_hex_decode);
85
 
 
86
 
        suite_add_tcase (s, tc_core);
87
 
 
88
 
        return s;
89
 
}