mirror of
https://github.com/deepseek-ai/3FS
synced 2025-06-26 18:16:45 +00:00
Initial commit
This commit is contained in:
27
tests/common/utils/TestReleaseVersion.cc
Normal file
27
tests/common/utils/TestReleaseVersion.cc
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "common/app/AppInfo.h"
|
||||
#include "tests/GtestHelpers.h"
|
||||
|
||||
namespace hf3fs::test {
|
||||
namespace {
|
||||
|
||||
TEST(TestReleaseVersion, testFormat) {
|
||||
auto rv = flat::ReleaseVersion::fromVersionInfoV0();
|
||||
ASSERT_EQ(fmt::format("Version: v{}", rv), VersionInfo::fullV0());
|
||||
|
||||
rv = flat::ReleaseVersion::fromVersionInfo();
|
||||
ASSERT_EQ(fmt::format("Version: v{}", rv), VersionInfo::full());
|
||||
}
|
||||
|
||||
TEST(TestReleaseVersion, testDeserializeFromV0) {
|
||||
auto rv = flat::ReleaseVersion::fromV0(0, 1, 4, 0xabcdef12, 1688016296, 54321);
|
||||
auto str = serde::serialize(rv);
|
||||
auto unpackRes = flat::ReleaseVersion::unpackFrom(str);
|
||||
ASSERT_TRUE(unpackRes);
|
||||
auto newRv = *unpackRes;
|
||||
ASSERT_EQ(newRv.toString(), "0.1.4-54321-20230629-abcdef12");
|
||||
auto rv2 = flat::ReleaseVersion::fromVersionInfo();
|
||||
ASSERT_TRUE(rv2 > rv);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace hf3fs::test
|
||||
Reference in New Issue
Block a user