MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isnegative

Method isnegative

test/testmathlib.cpp:876–890  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

874 }
875
876 void isnegative() const {
877 ASSERT_EQUALS(true, MathLib::isNegative("-1"));
878 ASSERT_EQUALS(true, MathLib::isNegative("-1."));
879 ASSERT_EQUALS(true, MathLib::isNegative("-1.0"));
880 ASSERT_EQUALS(true, MathLib::isNegative("-1.0E+2"));
881 ASSERT_EQUALS(true, MathLib::isNegative("-1.0E-2"));
882
883 ASSERT_EQUALS(false, MathLib::isNegative("+1"));
884 ASSERT_EQUALS(false, MathLib::isNegative("+1."));
885 ASSERT_EQUALS(false, MathLib::isNegative("+1.0"));
886 ASSERT_EQUALS(false, MathLib::isNegative("+1.0E+2"));
887 ASSERT_EQUALS(false, MathLib::isNegative("+1.0E-2"));
888 // test empty string
889 ASSERT_EQUALS(false, MathLib::isNegative(""));
890 }
891
892 void isoct() const {
893 // octal number format: [+|-]0[0-7][suffix]

Callers

nothing calls this directly

Calls 1

isNegativeFunction · 0.85

Tested by

no test coverage detected