From 9692fb72f6f428dbed4e107dd83fa906854babff Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Wed, 7 Feb 2007 17:35:38 +0000 Subject: Added max_state function git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/Nagios-Plugin/trunk@1615 f882894a-f735-0410-b71e-b25c423dba1c --- t/Nagios-Plugin-Functions-03.t | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 t/Nagios-Plugin-Functions-03.t (limited to 't') diff --git a/t/Nagios-Plugin-Functions-03.t b/t/Nagios-Plugin-Functions-03.t new file mode 100644 index 0000000..3706e4c --- /dev/null +++ b/t/Nagios-Plugin-Functions-03.t @@ -0,0 +1,21 @@ +# max_state tests + +use strict; +use Test::More tests => 8; + +BEGIN { use_ok("Nagios::Plugin::Functions", ":all") } + +my $new_state = max_state( OK, WARNING ); + +is( $new_state, WARNING, "Moved up to WARNING" ); +is( max_state( $new_state, UNKNOWN ), WARNING, "Still at WARNING" ); + +$new_state = max_state( $new_state, CRITICAL ); +is( $new_state, CRITICAL, "Now at CRITICAL" ); +is( max_state( OK, OK ), OK, "This is OK" ); + +is( max_state( OK, UNKNOWN ), OK, "This is still OK, not UNKNOWN" ); + +is( max_state( OK, OK, OK, OK, OK, WARNING ), WARNING, "Use WARNING in this list" ); + +is( max_state(), UNKNOWN, "Return UNKNOWN if no parameters" ); -- cgit v1.2.3-74-g34f1