summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLib/testSystemTools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/CMakeLib/testSystemTools.cxx')
-rw-r--r--Tests/CMakeLib/testSystemTools.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx
index 96a4819..121e639 100644
--- a/Tests/CMakeLib/testSystemTools.cxx
+++ b/Tests/CMakeLib/testSystemTools.cxx
@@ -93,5 +93,22 @@ int testSystemTools(int /*unused*/, char* /*unused*/ [])
if (!failed) {
cmPassed("cmSystemTools::strverscmp working");
}
+
+ // ----------------------------------------------------------------------
+ // Test cmSystemTools::StringToULong
+ {
+ unsigned long value;
+ cmAssert(cmSystemTools::StringToULong("1", &value) && value == 1,
+ "StringToULong parses a decimal integer.");
+ cmAssert(cmSystemTools::StringToULong(" 1", &value) && value == 1,
+ "StringToULong parses a decimal integer after whitespace.");
+ cmAssert(!cmSystemTools::StringToULong("-1", &value),
+ "StringToULong rejects a negative number.");
+ cmAssert(!cmSystemTools::StringToULong(" -1", &value),
+ "StringToULong rejects a negative number after whitespace.");
+ cmAssert(!cmSystemTools::StringToULong("1x", &value),
+ "StringToULong rejects trailing content.");
+ }
+
return failed;
}