]> granicus.if.org Git - icinga2/blobdiff - test/icinga-perfdata.cpp
Update consolecommand.cpp
[icinga2] / test / icinga-perfdata.cpp
index 134c7d5853e19ca3e3734ead1e619c0ed00ad2a6..bdd5ca28171ef626c79ed431c772680e1b69f098 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Icinga 2                                                                   *
- * Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)    *
+ * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)  *
  *                                                                            *
  * This program is free software; you can redistribute it and/or              *
  * modify it under the terms of the GNU General Public License                *
@@ -17,9 +17,9 @@
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "icinga/perfdatavalue.hpp"
+#include "base/perfdatavalue.hpp"
 #include "icinga/pluginutility.hpp"
-#include <boost/test/unit_test.hpp>
+#include <BoostTestTargetConfig.h>
 
 using namespace icinga;
 
@@ -114,10 +114,23 @@ BOOST_AUTO_TEST_CASE(warncritminmax)
        BOOST_CHECK(pv->Format() == "test=123456B;1000;2000;3000;4000");
 }
 
+BOOST_AUTO_TEST_CASE(ignore_invalid_warn_crit_min_max)
+{
+       PerfdataValue::Ptr pv = PerfdataValue::Parse("test=123456;1000:2000;0:3000;3000;4000");
+       BOOST_CHECK(pv);
+       BOOST_CHECK(pv->GetValue() == 123456);
+       BOOST_CHECK(pv->GetWarn() == Empty);
+       BOOST_CHECK(pv->GetCrit() == Empty);
+       BOOST_CHECK(pv->GetMin() == 3000);
+       BOOST_CHECK(pv->GetMax() == 4000);
+
+       BOOST_CHECK(pv->Format() == "test=123456");
+}
+
 BOOST_AUTO_TEST_CASE(invalid)
 {
+       BOOST_CHECK_THROW(PerfdataValue::Parse("123456"), boost::exception);
        BOOST_CHECK_THROW(PerfdataValue::Parse("test=1,23456"), boost::exception);
-       BOOST_CHECK_THROW(PerfdataValue::Parse("test=123456;10%;20%"), boost::exception);
 }
 
 BOOST_AUTO_TEST_CASE(multi)