From 80ed0b2ad14277e5f476c9874461a2716df7a0e3 Mon Sep 17 00:00:00 2001 From: Ettl Martin Date: Tue, 19 Jul 2011 09:10:34 +0200 Subject: [PATCH] testmathlib: improved testcoverage of mathlib --- test/testmathlib.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/test/testmathlib.cpp b/test/testmathlib.cpp index cd3637da3..65e7d2d96 100644 --- a/test/testmathlib.cpp +++ b/test/testmathlib.cpp @@ -36,6 +36,53 @@ private: TEST_CASE(isint); TEST_CASE(isnegative); TEST_CASE(isfloat); + TEST_CASE(isGreater) + TEST_CASE(isGreaterEqual) + TEST_CASE(isEqual) + TEST_CASE(isNotEqual) + TEST_CASE(isLess) + TEST_CASE(isLessEqual) + } + + + void isGreater() + { + ASSERT_EQUALS(true , MathLib::isGreater("1.0", "0.001")); + ASSERT_EQUALS(false, MathLib::isGreater("-1.0", "0.001")); + } + + void isGreaterEqual() + { + ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.00", "1.0")); + ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.001", "1.0")); + ASSERT_EQUALS(true , MathLib::isGreaterEqual("1.0", "0.001")); + ASSERT_EQUALS(false, MathLib::isGreaterEqual("-1.0", "0.001")); + } + + void isEqual() + { + ASSERT_EQUALS(true , MathLib::isEqual("1.0", "1.0")); + ASSERT_EQUALS(false , MathLib::isEqual("1.", "1.01")); + } + + void isNotEqual() + { + ASSERT_EQUALS(false , MathLib::isNotEqual("1.0", "1.0")); + ASSERT_EQUALS(true , MathLib::isNotEqual("1.", "1.01")); + } + + void isLess() + { + ASSERT_EQUALS(false , MathLib::isLess("1.0", "0.001")); + ASSERT_EQUALS(true , MathLib::isLess("-1.0", "0.001")); + } + + void isLessEqual() + { + ASSERT_EQUALS(true , MathLib::isLessEqual("1.00", "1.0")); + ASSERT_EQUALS(false , MathLib::isLessEqual("1.001", "1.0")); + ASSERT_EQUALS(false , MathLib::isLessEqual("1.0", "0.001")); + ASSERT_EQUALS(true , MathLib::isLessEqual("-1.0", "0.001")); } void calculate()