summaryrefslogtreecommitdiffstats
path: root/t/Nagios-Plugin-Threshold.t
diff options
context:
space:
mode:
authorTon Voon <tonvoon@users.sourceforge.net>2006-06-08 12:27:44 +0000
committerTon Voon <tonvoon@users.sourceforge.net>2006-06-08 12:27:44 +0000
commit2c6651034f76e2bccb549a867485f8fabbf07cb1 (patch)
tree8de53d7efe4564017e1ebce73353c7e3a3c8b548 /t/Nagios-Plugin-Threshold.t
parent83e29d795dddf34a652cda8665179b77372ddcfe (diff)
downloadmonitoring-plugin-perl-2c6651034f76e2bccb549a867485f8fabbf07cb1.tar.gz
Initial revision
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1419 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 't/Nagios-Plugin-Threshold.t')
-rw-r--r--t/Nagios-Plugin-Threshold.t32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/Nagios-Plugin-Threshold.t b/t/Nagios-Plugin-Threshold.t
new file mode 100644
index 0000000..764f7b0
--- /dev/null
+++ b/t/Nagios-Plugin-Threshold.t
@@ -0,0 +1,32 @@
1
2use strict;
3use Test::More tests => 18;
4BEGIN { use_ok('Nagios::Plugin::Threshold'); use_ok('Nagios::Plugin::Base') };
5
6Nagios::Plugin::Base->exit_on_die(0);
7Nagios::Plugin::Base->print_on_die(0);
8
9my $t = Nagios::Plugin::Threshold->set_thresholds(critical => "80");
10ok( defined $t, "Threshold ('', '80') set");
11ok( ! defined $t->warning, "Warning not set");
12cmp_ok( $t->critical->end, '==', 80, "Critical set correctly");
13
14$t = Nagios::Plugin::Threshold->set_thresholds(warning => "5:33", critical => "");
15ok( defined $t, "Threshold ('5:33', '') set");
16cmp_ok( $t->warning->start, '==', 5, "Warning start set");
17cmp_ok( $t->warning->end, '==', 33, "Warning end set");
18ok( ! defined $t->critical, "Critical not set");
19
20$t = Nagios::Plugin::Threshold->set_thresholds(warning => "30", critical => "60");
21ok( defined $t, "Threshold ('30', '60') set");
22cmp_ok( $t->warning->end, '==', 30, "Warning end set");
23cmp_ok( $t->critical->end, '==',60, "Critical end set");
24cmp_ok( $t->get_status(15.3), '==', $ERRORS{OK}, "15.3 - ok");
25cmp_ok( $t->get_status(30.0001), '==', $ERRORS{WARNING}, "30.0001 - warning");
26cmp_ok( $t->get_status(69), '==', $ERRORS{CRITICAL}, "69 - critical");
27
28$t = Nagios::Plugin::Threshold->set_thresholds(warning => "total", critical => "rubbish");
29ok( defined $t, "Threshold object created although ...");
30ok( ! defined $t->warning, "Warning not set");
31ok( ! defined $t->critical, "Critical not set");
32