1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
6
* Copyright (C) 2008 Free Software Foundation, Inc.
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
#include "glib-utils.h"
28
test_g_rand_string (void)
32
id = _g_rand_string (8);
33
g_assert_cmpint (strlen (id), == , 8);
36
id = _g_rand_string (16);
37
g_assert_cmpint (strlen (id), == , 16);
51
re = g_regex_new ("%prop\\{([^}]+)\\}", 0, 0, NULL);
52
a = g_regex_split (re, "thunderbird -compose %prop{ Exif::Image::DateTime } %ask %prop{ File::Size }", 0);
53
for (i = 0, n = 0; a[i] != NULL; i += 2)
56
b = g_new (char *, n + 1);
57
for (i = 1, j = 0; a[i] != NULL; i += 2) {
58
b[j++] = g_strstrip (a[i]);
61
attributes = g_strjoinv (",", b);
62
g_print ("==> %s\n", attributes);
76
g_test_init (&argc, &argv, NULL);
78
g_test_add_func ("/glib-utils/_g_rand_string/1", test_g_rand_string);