Skip to content
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
1 change: 1 addition & 0 deletions include/json/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,
#endif // if !defined(JSON_IS_AMALGAMATION)

namespace Json {
JSON_API const char* version();
using Int = int;
using UInt = unsigned int;
#if defined(JSON_NO_INT64)
Expand Down
2 changes: 2 additions & 0 deletions src/lib_json/json_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1704,4 +1704,6 @@ Value& Path::make(Value& root) const {
return *node;
}

const char* version() { return JSONCPP_VERSION_STRING; }

} // namespace Json
5 changes: 5 additions & 0 deletions src/test_lib_json/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4188,6 +4188,11 @@ JSONTEST_FIXTURE_LOCAL(VersionTest, VersionNumbersMatch) {
JSONTEST_ASSERT_EQUAL(vstr.str(), std::string(JSONCPP_VERSION_STRING));
}

JSONTEST_FIXTURE_LOCAL(VersionTest, RuntimeVersionString) {
JSONTEST_ASSERT_EQUAL(std::string(JSONCPP_VERSION_STRING),
std::string(Json::version()));
}

#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
Loading