1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#include <cassert>
#include <sstream>
#include "HCheckConfig.h"
#include "Highs.h"
#include "catch.hpp"
const bool dev_run = false;
// No commas in test case name.
TEST_CASE("HighsVersion", "[highs_version]") {
std::string version = std::string(highsVersion());
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();
if (dev_run) {
printf("HiGHS version: %s\n", version.c_str());
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", 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(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]") {
Highs highs;
HighsInt sizeof_highs_int = highs.getSizeofHighsInt();
#ifdef HIGHSINT64
REQUIRE(sizeof_highs_int == 8);
#else
REQUIRE(sizeof_highs_int == 4);
#endif
}
|