This commit is contained in:
Sam Kellett 2018-05-07 12:24:47 +00:00 committed by GitHub
commit bd2f01c9f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 0 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
build/
test/version_test.cpp

View File

@ -0,0 +1,17 @@
#ifndef YAML_CPP_VERSION_H
#define YAML_CPP_VERSION_H
#if defined(_MSC_VER) || \
(defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
(__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
#pragma once
#endif
#define YAML_CPP_VERSION_MAJOR 0
#define YAML_CPP_VERSION_MINOR 5
#define YAML_CPP_VERSION_PATCH 2
// String representation of the current version (ie. "0.1.2")
#define YAML_CPP_VERSION "0.5.2"
#endif // YAML_CPP_VERSION_H

View File

@ -23,6 +23,9 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR
endif()
endif()
# Create version_test.cpp
configure_file(${YAML_CPP_SOURCE_DIR}/test/version_test.cpp.in ${YAML_CPP_SOURCE_DIR}/test/version_test.cpp)
file(GLOB test_headers [a-z_]*.h)
file(GLOB test_sources [a-z_]*.cpp integration/[a-z_]*.cpp node/[a-z_]*.cpp)
file(GLOB test_new_api_sources new-api/[a-z]*.cpp)

27
test/version_test.cpp.in Normal file
View File

@ -0,0 +1,27 @@
#include "yaml-cpp/version.h"
#include "gtest/gtest.h"
namespace YAML {
namespace {
TEST(VersionTest, Major)
{
ASSERT_EQ(${YAML_CPP_VERSION_MAJOR}, YAML_CPP_VERSION_MAJOR);
}
TEST(VersionTest, Minor)
{
ASSERT_EQ(${YAML_CPP_VERSION_MINOR}, YAML_CPP_VERSION_MINOR);
}
TEST(VersionTest, Path)
{
ASSERT_EQ(${YAML_CPP_VERSION_PATCH}, YAML_CPP_VERSION_PATCH);
}
TEST(VersionTest, String)
{
ASSERT_STREQ("${YAML_CPP_VERSION}", YAML_CPP_VERSION);
}
}
}