File: test-data-objects.c

package info (click to toggle)
loudmouth 1.5.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,428 kB
  • sloc: ansic: 9,941; sh: 4,388; makefile: 218; xml: 33
file content (60 lines) | stat: -rw-r--r-- 2,003 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * Copyright (C) 2008 Imendio AB
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this program; if not, see <https://www.gnu.org/licenses>
 */

#include <stdlib.h>
#include <glib.h>

#include "loudmouth/lm-data-objects.h"

static void
test_auth_parameters ()
{
    LmAuthParameters *params;

    params = lm_auth_parameters_new ("my_user", "my_pass", "my_resource");
    g_assert (g_strcmp0 ("my_user", lm_auth_parameters_get_username (params)) == 0);
    g_assert (g_strcmp0 ("my_pass", lm_auth_parameters_get_password (params)) == 0);
    g_assert (g_strcmp0 ("my_resource", lm_auth_parameters_get_resource (params)) == 0);

    lm_auth_parameters_unref (params);
}

static void
test_connect_parameters ()
{
    LmConnectParameters *params;

    params = lm_connect_parameters_new ("my_domain", "my_host", 5223);
    g_assert (g_strcmp0 ("my_domain", lm_connect_parameters_get_domain (params)) == 0);
    g_assert (g_strcmp0 ("my_host", lm_connect_parameters_get_host (params)) == 0);
    g_assert (5223 == lm_connect_parameters_get_port (params));

    lm_connect_parameters_unref (params);
}

int
main (int argc, char **argv)
{
    g_test_init (&argc, &argv, NULL);

    g_test_add_func ("/data_objects/auth_paramters", test_auth_parameters);
    g_test_add_func ("/data_objects/connect_parameters", test_connect_parameters);

    return g_test_run ();
}