Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved const char* highsCompilationDate() below Highs class definition and updated unit test HighsVersion #1800

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading