From fee790daef90aa2a7ac650bd18b75037323f6f50 Mon Sep 17 00:00:00 2001 From: JAJHall Date: Wed, 12 Jun 2024 13:34:16 +0100 Subject: [PATCH] Moved const char* highsCompilationDate() below Highs class definition and updated unit test HighsVersion --- check/TestHighsVersion.cpp | 26 ++++++++++++++++++++++---- src/Highs.h | 9 +++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/check/TestHighsVersion.cpp b/check/TestHighsVersion.cpp index 6a133d1a03..0d41016f5b 100644 --- a/check/TestHighsVersion.cpp +++ b/check/TestHighsVersion.cpp @@ -13,6 +13,8 @@ TEST_CASE("HighsVersion", "[highs_version]") { const HighsInt major = highsVersionMajor(); const HighsInt minor = highsVersionMinor(); const HighsInt patch = highsVersionPatch(); + const std::string compilation = highsCompilationDate(); + const std::string githash = std::string(highsGithash()); std::stringstream ss; ss << major << "." << minor << "." << patch; std::string local_version = ss.str(); @@ -21,15 +23,31 @@ TEST_CASE("HighsVersion", "[highs_version]") { printf("HiGHS major version %d\n", int(major)); printf("HiGHS minor version %d\n", int(minor)); printf("HiGHS patch version %d\n", int(patch)); - printf("HiGHS githash: %s\n", highsGithash()); - // Compilation date is deprecated. - // printf("HiGHS compilation date: %s\n", highsCompilationDate()); + printf("HiGHS githash: %s\n", githash.c_str()); + // Compilation date is deprecated, but make sure that the + // deprecated method is still tested. + printf("HiGHS compilation date: %s\n", compilation.c_str()); printf("HiGHS local version: %s\n", local_version.c_str()); } REQUIRE(major == HIGHS_VERSION_MAJOR); REQUIRE(minor == HIGHS_VERSION_MINOR); REQUIRE(patch == HIGHS_VERSION_PATCH); - REQUIRE(local_version == version); + REQUIRE(githash == std::string(HIGHS_GITHASH)); + REQUIRE(version == local_version); + // Check that the corresponding methods + Highs highs; + const std::string version0 = highs.version(); + REQUIRE(version0 == version); + const HighsInt major0 = highs.versionMajor(); + REQUIRE(major0 == major); + const HighsInt minor0 = highs.versionMinor(); + REQUIRE(minor0 == minor); + const HighsInt patch0 = highs.versionPatch(); + REQUIRE(patch0 == patch); + const std::string githash0 = highs.githash(); + REQUIRE(githash0 == githash); + const std::string compilation0 = highs.compilationDate(); + REQUIRE(compilation == compilation); } TEST_CASE("sizeof-highs-int", "[highs_version]") { diff --git a/src/Highs.h b/src/Highs.h index ade7bcad70..7b3c08ca26 100644 --- a/src/Highs.h +++ b/src/Highs.h @@ -37,7 +37,6 @@ HighsInt highsVersionMajor(); HighsInt highsVersionMinor(); HighsInt highsVersionPatch(); const char* highsGithash(); -const char* highsCompilationDate(); /** * @brief Class to set parameters and run HiGHS @@ -1213,9 +1212,6 @@ class Highs { // Start of deprecated methods - /** - * @brief Return compilation date - */ std::string compilationDate() const { return "deprecated"; } HighsStatus setLogCallback(void (*user_log_callback)(HighsLogType, @@ -1525,4 +1521,9 @@ class Highs { const double ill_conditioning_bound); bool infeasibleBoundsOk(); }; + +// Start of deprecated methods not in the Highs class + +const char* highsCompilationDate(); + #endif