diff options
Diffstat (limited to 'plugins/tests/test_disk.c')
-rw-r--r-- | plugins/tests/test_disk.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/plugins/tests/test_disk.c b/plugins/tests/test_disk.c new file mode 100644 index 00000000..19cc3acd --- /dev/null +++ b/plugins/tests/test_disk.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /****************************************************************************** | ||
2 | |||
3 | This program is free software; you can redistribute it and/or modify | ||
4 | it under the terms of the GNU General Public License as published by | ||
5 | the Free Software Foundation; either version 2 of the License, or | ||
6 | (at your option) any later version. | ||
7 | |||
8 | This program is distributed in the hope that it will be useful, | ||
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | GNU General Public License for more details. | ||
12 | |||
13 | You should have received a copy of the GNU General Public License | ||
14 | along with this program; if not, write to the Free Software | ||
15 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
16 | |||
17 | $Id$ | ||
18 | |||
19 | ******************************************************************************/ | ||
20 | |||
21 | #include "common.h" | ||
22 | #include "utils_disk.h" | ||
23 | #include "tap.h" | ||
24 | |||
25 | int | ||
26 | main (int argc, char **argv) | ||
27 | { | ||
28 | struct name_list *exclude_filesystem=NULL; | ||
29 | struct name_list *exclude_fstype=NULL; | ||
30 | |||
31 | plan_tests(8); | ||
32 | |||
33 | ok( np_find_name(exclude_filesystem, "/var") == FALSE, "/var not in list"); | ||
34 | np_add_name(&exclude_filesystem, "/var"); | ||
35 | ok( np_find_name(exclude_filesystem, "/var") == TRUE, "is in list now"); | ||
36 | ok( np_find_name(exclude_filesystem, "/home") == FALSE, "/home not in list"); | ||
37 | np_add_name(&exclude_filesystem, "/home"); | ||
38 | ok( np_find_name(exclude_filesystem, "/home") == TRUE, "is in list now"); | ||
39 | ok( np_find_name(exclude_filesystem, "/var") == TRUE, "/var still in list"); | ||
40 | |||
41 | ok( np_find_name(exclude_fstype, "iso9660") == FALSE, "iso9660 not in list"); | ||
42 | np_add_name(&exclude_fstype, "iso9660"); | ||
43 | ok( np_find_name(exclude_fstype, "iso9660") == TRUE, "is in list now"); | ||
44 | |||
45 | ok( np_find_name(exclude_filesystem, "iso9660") == FALSE, "Make sure no clashing in variables"); | ||
46 | |||
47 | |||
48 | |||
49 | |||
50 | /* | ||
51 | range = parse_range_string("6"); | ||
52 | ok( range != NULL, "'6' is valid range"); | ||
53 | ok( range->start == 0, "Start correct"); | ||
54 | ok( range->start_infinity == FALSE, "Not using negative infinity"); | ||
55 | ok( range->end == 6, "End correct"); | ||
56 | ok( range->end_infinity == FALSE, "Not using infinity"); | ||
57 | free(range); | ||
58 | |||
59 | range = parse_range_string("-7:23"); | ||
60 | ok( range != NULL, "'-7:23' is valid range"); | ||
61 | ok( range->start == -7, "Start correct"); | ||
62 | ok( range->start_infinity == FALSE, "Not using negative infinity"); | ||
63 | ok( range->end == 23, "End correct"); | ||
64 | ok( range->end_infinity == FALSE, "Not using infinity"); | ||
65 | free(range); | ||
66 | |||
67 | range = parse_range_string(":5.75"); | ||
68 | ok( range != NULL, "':5.75' is valid range"); | ||
69 | ok( range->start == 0, "Start correct"); | ||
70 | ok( range->start_infinity == FALSE, "Not using negative infinity"); | ||
71 | ok( range->end == 5.75, "End correct"); | ||
72 | ok( range->end_infinity == FALSE, "Not using infinity"); | ||
73 | free(range); | ||
74 | |||
75 | range = parse_range_string("~:-95.99"); | ||
76 | ok( range != NULL, "~:-95.99' is valid range"); | ||
77 | ok( range->start_infinity == TRUE, "Using negative infinity"); | ||
78 | ok( range->end == -95.99, "End correct (with rounding errors)"); | ||
79 | ok( range->end_infinity == FALSE, "Not using infinity"); | ||
80 | free(range); | ||
81 | */ | ||
82 | |||
83 | return exit_status(); | ||
84 | } | ||
85 | |||