Browse Source

update: add default value for metadata

legacy
Dnomd343 2 years ago
parent
commit
0709e00d96
  1. 16
      src/klotski_core/CMakeLists.txt
  2. 10
      test/ffi/metadata.cc

16
src/klotski_core/CMakeLists.txt

@ -51,13 +51,23 @@ endmacro()
################################################################################
set(GIT_BRANCH "")
set(GIT_TAG_LONG "")
set(GIT_COMMIT_LONG "")
git_tag(GIT_TAG_LONG)
if(GIT_TAG_LONG STREQUAL "") # without git tag
set(GIT_TAG_LONG "unknown")
endif()
set(GIT_BRANCH "")
git_branch(GIT_BRANCH)
if(GIT_BRANCH STREQUAL "") # without git branch
set(GIT_BRANCH "unknown")
endif()
set(GIT_COMMIT_LONG "")
git_commit_id(GIT_COMMIT_LONG)
if(GIT_COMMIT_LONG STREQUAL "") # without git commit
set(GIT_COMMIT_LONG "unknown")
endif()
set(PLAT "${CMAKE_SYSTEM_NAME}")
set(ARCH "${CMAKE_SYSTEM_PROCESSOR}")

10
test/ffi/metadata.cc

@ -3,6 +3,16 @@
#include "gtest/gtest.h"
TEST(FFI, metadata) {
EXPECT_STRNE(get_author(), "");
EXPECT_STRNE(get_git_tag(), "");
EXPECT_STRNE(get_version(), "");
EXPECT_STRNE(get_commit_id(), "");
EXPECT_STRNE(get_build_time(), "");
EXPECT_STRNE(get_git_branch(), "");
EXPECT_STRNE(get_project_url(), "");
EXPECT_STRNE(get_system_info(), "");
EXPECT_STRNE(get_compiler_info(), "");
EXPECT_STREQ(get_author(), AUTHOR);
EXPECT_STREQ(get_git_tag(), GIT_TAG_ID);
EXPECT_STREQ(get_version(), VERSION_STR);

Loading…
Cancel
Save