2
* glade_util.c -- Test for alarm utilities.
4
* Copyright (C) 2007-2008 Johannes H. Jensen <joh@pseudoberries.com>
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program 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
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
* Johannes H. Jensen <joh@pseudoberries.com>
29
#define FILENAME1 "some.file.ext"
30
#define FILENAME2 "some file"
33
#define CMD2 "not-found"
37
gchar *tmp, ftime[256];
43
g_print ("Testing to_basename():\n\n");
45
tmp = to_basename (FILENAME1);
46
g_print ("to_basename (" FILENAME1 "): %s\n", tmp);
49
tmp = to_basename (FILENAME2);
50
g_print ("to_basename (" FILENAME2 "): %s\n", tmp);
56
g_print ("\nTesting run_command():\n\n");
58
ret = command_run (CMD1);
59
g_print ("Running " CMD1 " = %d\n", ret);
61
ret = command_run (CMD2);
62
g_print ("Running " CMD2 " = %d\n", ret);
67
g_print ("\nTesting get_alarm_timestamp()\n\n");
70
tm = localtime (&now);
72
strftime (ftime, sizeof (ftime), "%c", tm);
78
g_print ("Time: %s\n", ftime);
79
ts = get_alarm_timestamp(hour, min, sec - 10);
81
g_print ("For -10s: %d: %s\n", ts, ctime (&ts));
82
ts = get_alarm_timestamp(hour, min, sec + 10);
84
g_print ("For +10s: %d: %s\n", ts, ctime (&ts));