diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2019-08-16 18:49:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-08-16 18:49:28 (GMT) |
commit | dcf2beb7dec757b7e28eba43fb7f2d5498bded39 (patch) | |
tree | b4dcb409eea4f99a58f02711edba5452c8613cfc | |
parent | 6f1781c63ad58c3c84987dce7eee36668ed2ba57 (diff) | |
parent | 935fbe0b0454163678bc4ef19e1bee95a7a31b4d (diff) | |
download | CMake-dcf2beb7dec757b7e28eba43fb7f2d5498bded39.zip CMake-dcf2beb7dec757b7e28eba43fb7f2d5498bded39.tar.gz CMake-dcf2beb7dec757b7e28eba43fb7f2d5498bded39.tar.bz2 |
Merge topic 'cmStringAlgorithms_ulong'
935fbe0b04 cmStringAlgorithms: Add cmStrToLong and cmStrToULong
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3681
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestSubmitHandler.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestCommand.cxx | 7 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 3 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 10 | ||||
-rw-r--r-- | Source/cmFileCommand.cxx | 3 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmParseArgumentsCommand.cxx | 4 | ||||
-rw-r--r-- | Source/cmPolicies.cxx | 2 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 4 | ||||
-rw-r--r-- | Source/cmQtAutoGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmQtAutoMocUic.cxx | 5 | ||||
-rw-r--r-- | Source/cmStringAlgorithms.cxx | 34 | ||||
-rw-r--r-- | Source/cmStringAlgorithms.h | 9 | ||||
-rw-r--r-- | Source/cmStringCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 22 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 4 | ||||
-rw-r--r-- | Source/cmakemain.cxx | 4 | ||||
-rw-r--r-- | Tests/CMakeLib/testStringAlgorithms.cxx | 35 | ||||
-rw-r--r-- | Tests/CMakeLib/testSystemTools.cxx | 16 |
20 files changed, 105 insertions, 74 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 42534f7..ae965ea 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -10,6 +10,7 @@ #include "cmDuration.h" #include "cmListFileCache.h" #include "cmRange.h" +#include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmWorkingDirectory.h" @@ -110,8 +111,7 @@ void cmCTestMultiProcessHandler::SetTestLoad(unsigned long load) std::string fake_load_value; if (cmSystemTools::GetEnv("__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING", fake_load_value)) { - if (!cmSystemTools::StringToULong(fake_load_value.c_str(), - &this->FakeLoadForTesting)) { + if (!cmStrToULong(fake_load_value, &this->FakeLoadForTesting)) { cmSystemTools::Error("Failed to parse fake load value: " + fake_load_value); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 17ef350..f97d7eb 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -529,8 +529,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, auto retryDelay = std::chrono::seconds(0); if (!retryDelayString.empty()) { unsigned long retryDelayValue = 0; - if (!cmSystemTools::StringToULong(retryDelayString.c_str(), - &retryDelayValue)) { + if (!cmStrToULong(retryDelayString, &retryDelayValue)) { cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : " << retryDelayString << std::endl); @@ -540,7 +539,7 @@ int cmCTestSubmitHandler::HandleCDashUploadFile(std::string const& file, } unsigned long retryCount = 0; if (!retryCountString.empty()) { - if (!cmSystemTools::StringToULong(retryCountString.c_str(), &retryCount)) { + if (!cmStrToULong(retryCountString, &retryCount)) { cmCTestLog(this->CTest, WARNING, "Invalid value for 'RETRY_DELAY' : " << retryCountString << std::endl); diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index cfd5e3d..24de5b4 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -7,7 +7,7 @@ #include "cmCTestTestHandler.h" #include "cmDuration.h" #include "cmMakefile.h" -#include "cmSystemTools.h" +#include "cmStringAlgorithms.h" #include <chrono> #include <sstream> @@ -110,15 +110,14 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() unsigned long testLoad; const char* ctestTestLoad = this->Makefile->GetDefinition("CTEST_TEST_LOAD"); if (this->Values[ctt_TEST_LOAD] && *this->Values[ctt_TEST_LOAD]) { - if (!cmSystemTools::StringToULong(this->Values[ctt_TEST_LOAD], - &testLoad)) { + if (!cmStrToULong(this->Values[ctt_TEST_LOAD], &testLoad)) { testLoad = 0; cmCTestLog(this->CTest, WARNING, "Invalid value for 'TEST_LOAD' : " << this->Values[ctt_TEST_LOAD] << std::endl); } } else if (ctestTestLoad && *ctestTestLoad) { - if (!cmSystemTools::StringToULong(ctestTestLoad, &testLoad)) { + if (!cmStrToULong(ctestTestLoad, &testLoad)) { testLoad = 0; cmCTestLog(this->CTest, WARNING, "Invalid value for 'CTEST_TEST_LOAD' : " << ctestTestLoad diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 67c24ca..17e7822 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -2193,8 +2193,7 @@ bool cmCTestTestHandler::SetTestsProperties( cmListFileContext fc; fc.FilePath = triples[i - 3]; long line = 0; - if (!cmSystemTools::StringToLong(triples[i - 2].c_str(), - &line)) { + if (!cmStrToLong(triples[i - 2], &line)) { line = 0; } fc.Line = line; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index c0ca73b..92ed839 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -754,7 +754,7 @@ bool cmCTest::UpdateCTestConfiguration() std::string const& testLoad = this->GetCTestConfiguration("TestLoad"); if (!testLoad.empty()) { unsigned long load; - if (cmSystemTools::StringToULong(testLoad.c_str(), &load)) { + if (cmStrToULong(testLoad, &load)) { this->SetTestLoad(load); } else { cmCTestLog(this, WARNING, @@ -1854,7 +1854,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, } i++; long repeat = 1; - if (!cmSystemTools::StringToLong(args[i].c_str(), &repeat)) { + if (!cmStrToLong(args[i], &repeat)) { errormsg = "'--repeat-until-fail' given non-integer value '" + args[i] + "'"; return false; @@ -1868,7 +1868,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, if (this->CheckArgument(arg, "--test-load") && i < args.size() - 1) { i++; unsigned long load; - if (cmSystemTools::StringToULong(args[i].c_str(), &load)) { + if (cmStrToULong(args[i], &load)) { this->SetTestLoad(load); } else { cmCTestLog(this, WARNING, @@ -1942,7 +1942,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, i < args.size() - 1) { i++; long outputSize; - if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) { + if (cmStrToLong(args[i], &outputSize)) { this->Impl->TestHandler.SetTestOutputSizePassed(int(outputSize)); } else { cmCTestLog(this, WARNING, @@ -1954,7 +1954,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i, i < args.size() - 1) { i++; long outputSize; - if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) { + if (cmStrToLong(args[i], &outputSize)) { this->Impl->TestHandler.SetTestOutputSizeFailed(int(outputSize)); } else { cmCTestLog(this, WARNING, diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index d76692c..87e97dd 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2357,8 +2357,7 @@ bool HandleLockCommand(std::vector<std::string> const& args, return false; } long scanned; - if (!cmSystemTools::StringToLong(args[i].c_str(), &scanned) || - scanned < 0) { + if (!cmStrToLong(args[i], &scanned) || scanned < 0) { std::ostringstream e; e << "TIMEOUT value \"" << args[i] << "\" is not an unsigned integer."; status.GetMakefile().IssueMessage(MessageType::FATAL_ERROR, e.str()); diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index addb0c7..29caa16 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -560,7 +560,7 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures() if (pos != std::string::npos) { const char* fv = &this->NinjaVersion[pos + k_DYNDEP_.size()]; unsigned long dyndep = 0; - cmSystemTools::StringToULong(fv, &dyndep); + cmStrToULong(fv, &dyndep); if (dyndep == 1) { this->NinjaSupportsDyndeps = true; } diff --git a/Source/cmParseArgumentsCommand.cxx b/Source/cmParseArgumentsCommand.cxx index 04fa0fb..df9407d 100644 --- a/Source/cmParseArgumentsCommand.cxx +++ b/Source/cmParseArgumentsCommand.cxx @@ -131,7 +131,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, } parseFromArgV = true; argIter++; // move past PARSE_ARGV - if (!cmSystemTools::StringToULong(argIter->c_str(), &argvStart)) { + if (!cmStrToULong(*argIter, &argvStart)) { this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "PARSE_ARGV index '" + *argIter + "' is not an unsigned integer"); @@ -185,7 +185,7 @@ bool cmParseArgumentsCommand::InitialPass(std::vector<std::string> const& args, // in the PARSE_ARGV move read the arguments from ARGC and ARGV# std::string argc = this->Makefile->GetSafeDefinition("ARGC"); unsigned long count; - if (!cmSystemTools::StringToULong(argc.c_str(), &count)) { + if (!cmStrToULong(argc, &count)) { this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "PARSE_ARGV called with ARGC='" + argc + "' that is not an unsigned integer"); diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 51a61dc..d33cd32 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -34,7 +34,7 @@ static bool stringToId(const char* input, cmPolicies::PolicyID& pid) } } long id; - if (!cmSystemTools::StringToLong(input + 3, &id)) { + if (!cmStrToLong(input + 3, &id)) { return false; } if (id >= cmPolicies::CMPCOUNT) { diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 360df25..d6bef6b 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -243,7 +243,7 @@ bool cmQtAutoGenInitializer::InitCustomTargets() this->Verbosity = makefile->GetSafeDefinition("CMAKE_AUTOGEN_VERBOSE"); if (!this->Verbosity.empty()) { unsigned long iVerb = 0; - if (!cmSystemTools::StringToULong(this->Verbosity.c_str(), &iVerb)) { + if (!cmStrToULong(this->Verbosity, &iVerb)) { // Non numeric verbosity this->Verbosity = cmSystemTools::IsOn(this->Verbosity) ? "1" : "0"; } @@ -1523,7 +1523,7 @@ void cmQtAutoGenInitializer::AddCleanFile(std::string const& fileName) static unsigned int CharPtrToUInt(const char* const input) { unsigned long tmp = 0; - if (input != nullptr && cmSystemTools::StringToULong(input, &tmp)) { + if (input != nullptr && cmStrToULong(input, &tmp)) { return static_cast<unsigned int>(tmp); } return 0; diff --git a/Source/cmQtAutoGenerator.cxx b/Source/cmQtAutoGenerator.cxx index 0ad87b1..996b2bc 100644 --- a/Source/cmQtAutoGenerator.cxx +++ b/Source/cmQtAutoGenerator.cxx @@ -22,7 +22,7 @@ cmQtAutoGenerator::Logger::Logger() std::string verbose; if (cmSystemTools::GetEnv("VERBOSE", verbose) && !verbose.empty()) { unsigned long iVerbose = 0; - if (cmSystemTools::StringToULong(verbose.c_str(), &iVerbose)) { + if (cmStrToULong(verbose, &iVerbose)) { SetVerbosity(static_cast<unsigned int>(iVerbose)); } else { // Non numeric verbosity @@ -46,7 +46,7 @@ cmQtAutoGenerator::Logger::~Logger() = default; void cmQtAutoGenerator::Logger::RaiseVerbosity(std::string const& value) { unsigned long verbosity = 0; - if (cmSystemTools::StringToULong(value.c_str(), &verbosity)) { + if (cmStrToULong(value, &verbosity)) { if (this->Verbosity_ < verbosity) { this->Verbosity_ = static_cast<unsigned int>(verbosity); } diff --git a/Source/cmQtAutoMocUic.cxx b/Source/cmQtAutoMocUic.cxx index e693816..6f3b2c6 100644 --- a/Source/cmQtAutoMocUic.cxx +++ b/Source/cmQtAutoMocUic.cxx @@ -1582,7 +1582,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile) BaseConst_.MultiConfig = InfoGetBool("AM_MULTI_CONFIG"); { unsigned long num = 1; - if (cmSystemTools::StringToULong(InfoGet("AM_PARALLEL").c_str(), &num)) { + if (cmStrToULong(InfoGet("AM_PARALLEL"), &num)) { num = std::max<unsigned long>(num, 1); num = std::min<unsigned long>(num, ParallelMax); } @@ -1630,8 +1630,7 @@ bool cmQtAutoMocUic::Init(cmMakefile* makefile) // - Qt environment { unsigned long qtv = BaseConst_.QtVersionMajor; - if (cmSystemTools::StringToULong(InfoGet("AM_QT_VERSION_MAJOR").c_str(), - &qtv)) { + if (cmStrToULong(InfoGet("AM_QT_VERSION_MAJOR"), &qtv)) { BaseConst_.QtVersionMajor = static_cast<unsigned int>(qtv); } } diff --git a/Source/cmStringAlgorithms.cxx b/Source/cmStringAlgorithms.cxx index eca761b..fa47d77 100644 --- a/Source/cmStringAlgorithms.cxx +++ b/Source/cmStringAlgorithms.cxx @@ -4,6 +4,8 @@ #include <algorithm> #include <cstdio> +#include <errno.h> +#include <stdlib.h> std::string cmTrimWhitespace(cm::string_view str) { @@ -138,3 +140,35 @@ std::string cmCatViews(std::initializer_list<cm::string_view> views) } return result; } + +bool cmStrToLong(const char* str, long* value) +{ + errno = 0; + char* endp; + *value = strtol(str, &endp, 10); + return (*endp == '\0') && (endp != str) && (errno == 0); +} + +bool cmStrToLong(std::string const& str, long* value) +{ + return cmStrToLong(str.c_str(), value); +} + +bool cmStrToULong(const char* str, unsigned long* value) +{ + errno = 0; + char* endp; + while (cmIsSpace(*str)) { + ++str; + } + if (*str == '-') { + return false; + } + *value = strtoul(str, &endp, 10); + return (*endp == '\0') && (endp != str) && (errno == 0); +} + +bool cmStrToULong(std::string const& str, unsigned long* value) +{ + return cmStrToULong(str.c_str(), value); +} diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index 44b01b8..968cc14 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -193,4 +193,13 @@ inline void cmStripSuffixIfExists(std::string& str, cm::string_view suffix) } } +/** Converts a string to long. Expects that the whole string is an integer. */ +bool cmStrToLong(const char* str, long* value); +bool cmStrToLong(std::string const& str, long* value); + +/** Converts a string to unsigned long. Expects that the whole string is an + * integer */ +bool cmStrToULong(const char* str, unsigned long* value); +bool cmStrToULong(std::string const& str, unsigned long* value); + #endif diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 46d9459..41d48ed 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -736,7 +736,7 @@ bool cmStringCommand::HandleRepeatCommand(std::vector<std::string> const& args) } unsigned long times; - if (!cmSystemTools::StringToULong(args[ArgPos::TIMES].c_str(), ×)) { + if (!cmStrToULong(args[ArgPos::TIMES], ×)) { this->Makefile->IssueMessage(MessageType::FATAL_ERROR, "repeat count is not a positive number."); return true; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ee60f16..9341f83 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2854,28 +2854,6 @@ bool cmSystemTools::RepeatedRemoveDirectory(const std::string& dir) #endif } -bool cmSystemTools::StringToLong(const char* str, long* value) -{ - errno = 0; - char* endp; - *value = strtol(str, &endp, 10); - return (*endp == '\0') && (endp != str) && (errno == 0); -} - -bool cmSystemTools::StringToULong(const char* str, unsigned long* value) -{ - errno = 0; - char* endp; - while (isspace(*str)) { - ++str; - } - if (*str == '-') { - return false; - } - *value = strtoul(str, &endp, 10); - return (*endp == '\0') && (endp != str) && (errno == 0); -} - std::string cmSystemTools::EncodeURL(std::string const& in, bool escapeSlashes) { std::string out; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 4f76b00..4bb6730 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -500,10 +500,6 @@ public: /** Remove a directory; repeat a few times in case of locked files. */ static bool RepeatedRemoveDirectory(const std::string& dir); - /** Convert string to long. Expected that the whole string is an integer */ - static bool StringToLong(const char* str, long* value); - static bool StringToULong(const char* str, unsigned long* value); - /** Encode a string as a URL. */ static std::string EncodeURL(std::string const& in, bool escapeSlashes = true); diff --git a/Source/cmakemain.cxx b/Source/cmakemain.cxx index 522f9a4..74c0d0f 100644 --- a/Source/cmakemain.cxx +++ b/Source/cmakemain.cxx @@ -321,7 +321,7 @@ int extract_job_number(int& index, char const* current, char const* next, unsigned long numJobs = 0; if (jobString.empty()) { jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL; - } else if (cmSystemTools::StringToULong(jobString.c_str(), &numJobs)) { + } else if (cmStrToULong(jobString, &numJobs)) { if (numJobs == 0) { std::cerr << "The <jobs> value requires a positive integer argument.\n\n"; @@ -439,7 +439,7 @@ int do_build(int ac, char const* const* av) jobs = cmake::DEFAULT_BUILD_PARALLEL_LEVEL; } else { unsigned long numJobs = 0; - if (cmSystemTools::StringToULong(parallel.c_str(), &numJobs)) { + if (cmStrToULong(parallel, &numJobs)) { if (numJobs == 0) { std::cerr << "The CMAKE_BUILD_PARALLEL_LEVEL environment variable " "requires a positive integer argument.\n\n"; diff --git a/Tests/CMakeLib/testStringAlgorithms.cxx b/Tests/CMakeLib/testStringAlgorithms.cxx index f833502..a92a910 100644 --- a/Tests/CMakeLib/testStringAlgorithms.cxx +++ b/Tests/CMakeLib/testStringAlgorithms.cxx @@ -190,5 +190,40 @@ int testStringAlgorithms(int /*unused*/, char* /*unused*/ []) assert_ok(!cmHasLiteralSuffix(str, "ab"), "cmHasLiteralPrefix string not"); } + // ---------------------------------------------------------------------- + // Test cmStrToLong + { + long value; + assert_ok(cmStrToLong("1", &value) && value == 1, + "cmStrToLong parses a positive decimal integer."); + assert_ok(cmStrToLong(" 1", &value) && value == 1, + "cmStrToLong parses a decimal integer after whitespace."); + + assert_ok(cmStrToLong("-1", &value) && value == -1, + "cmStrToLong parses a negative decimal integer."); + assert_ok( + cmStrToLong(" -1", &value) && value == -1, + "cmStrToLong parses a negative decimal integer after whitespace."); + + assert_ok(!cmStrToLong("1x", &value), + "cmStrToLong rejects trailing content."); + } + + // ---------------------------------------------------------------------- + // Test cmStrToULong + { + unsigned long value; + assert_ok(cmStrToULong("1", &value) && value == 1, + "cmStrToULong parses a decimal integer."); + assert_ok(cmStrToULong(" 1", &value) && value == 1, + "cmStrToULong parses a decimal integer after whitespace."); + assert_ok(!cmStrToULong("-1", &value), + "cmStrToULong rejects a negative number."); + assert_ok(!cmStrToULong(" -1", &value), + "cmStrToULong rejects a negative number after whitespace."); + assert_ok(!cmStrToULong("1x", &value), + "cmStrToULong rejects trailing content."); + } + return failed; } diff --git a/Tests/CMakeLib/testSystemTools.cxx b/Tests/CMakeLib/testSystemTools.cxx index 121e639..0a757df 100644 --- a/Tests/CMakeLib/testSystemTools.cxx +++ b/Tests/CMakeLib/testSystemTools.cxx @@ -94,21 +94,5 @@ int testSystemTools(int /*unused*/, char* /*unused*/ []) 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; } |