Skip to content

Commit

Permalink
Moved const char* highsCompilationDate() below Highs class definition…
Browse files Browse the repository at this point in the history
… and updated unit test HighsVersion
  • Loading branch information
jajhall committed Jun 12, 2024
1 parent 347bde4 commit fee790d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
26 changes: 22 additions & 4 deletions check/TestHighsVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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]") {
Expand Down
9 changes: 5 additions & 4 deletions src/Highs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ HighsInt highsVersionMajor();
HighsInt highsVersionMinor();
HighsInt highsVersionPatch();
const char* highsGithash();
const char* highsCompilationDate();

/**
* @brief Class to set parameters and run HiGHS
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

0 comments on commit fee790d

Please sign in to comment.