2
* Copyright (C) 2011 Google Inc.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General
15
* Public License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17
* Boston, MA 02111-1307, USA.
19
* Author: Nikki VonHollen <vonhollen@google.com>
23
#include <polkit/polkit.h>
30
PolkitUnixNetgroup *netgroup;
31
const char *netgroup_name;
33
netgroup = POLKIT_UNIX_NETGROUP (polkit_unix_netgroup_new ("testgroup"));
36
netgroup_name = polkit_unix_netgroup_get_name (netgroup);
37
g_assert_cmpstr (netgroup_name, ==, "testgroup");
39
g_object_unref (netgroup);
46
PolkitUnixNetgroup *netgroup;
47
const char *netgroup_name;
48
char new_name_buf [] = "foo";
50
netgroup = POLKIT_UNIX_NETGROUP (polkit_unix_netgroup_new ("testgroup"));
52
polkit_unix_netgroup_set_name (netgroup, new_name_buf);
53
netgroup_name = polkit_unix_netgroup_get_name (netgroup);
54
g_assert_cmpstr (netgroup_name, ==, "foo");
56
memcpy(new_name_buf, "bar", 3);
57
netgroup_name = polkit_unix_netgroup_get_name (netgroup);
58
g_assert_cmpstr (netgroup_name, ==, "foo");
60
polkit_unix_netgroup_set_name (netgroup, new_name_buf);
61
netgroup_name = polkit_unix_netgroup_get_name (netgroup);
62
g_assert_cmpstr (netgroup_name, ==, "bar");
64
g_object_unref (netgroup);
69
main (int argc, char *argv[])
72
g_test_init (&argc, &argv, NULL);
73
g_test_add_func ("/PolkitUnixNetgroup/new", test_new);
74
g_test_add_func ("/PolkitUnixNetgroup/set_name", test_set_name);