[nagiosplug] Adding tests for range @1:1

"Nagios Plugin Development" <[email protected]> Sat, 17 Aug 2013 20:50:53 +0000
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
    Module: nagiosplug
    Branch: master
    Commit: 30bf8025d2ccb7c1fdcf4f69ed543cba4e753625
    Author: Dominique Broeglin <[email protected]>
 Committer: Holger Weiss <[email protected]>
      Date: Sat Jan 26 21:30:55 2013 +0100
       URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=30bf802

Adding tests for range @1:1

---

 lib/tests/test_utils.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/lib/tests/test_utils.c b/lib/tests/test_utils.c
index d4a0800..79e1110 100644
--- a/lib/tests/test_utils.c
+++ b/lib/tests/test_utils.c
@@ -38,7 +38,7 @@ main (int argc, char **argv)
 	state_data *temp_state_data;
 	time_t	current_time;
 
-	plan_tests(141);
+	plan_tests(150);
 
 	ok( this_nagios_plugin==NULL, "nagios_plugin not initialised");
 
@@ -132,6 +132,18 @@ main (int argc, char **argv)
 	ok( check_range(0, range)     == TRUE, "0 - alert");
 	free(range);
 
+	range = parse_range_string("@1:1");
+	ok( range != NULL, "'@1:1' is a valid range");
+	ok( range->start == 1, "Start correct");
+	ok( range->start_infinity == FALSE, "Not using negative infinity");
+	ok( range->end == 1, "End correct");
+	ok( range->end_infinity == FALSE, "Not using infinity");
+	ok( range->alert_on == INSIDE, "Will alert on inside of this range" );
+	ok( check_range(0.5, range) == FALSE, "0.5 - no alert");
+	ok( check_range(1, range) == TRUE, "1 - alert");
+	ok( check_range(5.2, range) == FALSE, "5.2 - no alert");
+	free(range);
+
 	range = parse_range_string("1:1");
 	ok( range != NULL, "'1:1' is a valid range");
 	ok( range->start == 1, "Start correct");


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk