Skip to content

Commit

Permalink
Add version tests
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed Aug 10, 2024
1 parent 6a517b7 commit cbbe95f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
15 changes: 15 additions & 0 deletions changelog/current.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## New features

- [PR#459](https://github.com/biojppm/rapidyaml/pull/459): Add version functions and macros:
```cpp
#define RYML_VERSION "0.7.1"
#define RYML_VERSION_MAJOR 0
#define RYML_VERSION_MINOR 7
#define RYML_VERSION_PATCH 1
csubstr version();
int version_major();
int version_minor();
int version_patch();
```
## Fixes
- Fix [#440](https://github.com/biojppm/rapidyaml/issues/440): some tests failing with gcc -O2 (hypothetically due to undefined behavior)
Expand All @@ -13,5 +27,6 @@
## Thanks
- @marcalff
- @toge
- @musicinmybrain
1 change: 1 addition & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ ryml_add_engine_test(parse_engine_6_qmrk)
ryml_add_engine_test(parse_engine_7_seqimap)
ryml_add_engine_test(parse_engine_8_scalars_tokens)
ryml_add_engine_test(yaml_events)
ryml_add_test(version)
ryml_add_test(callbacks)
ryml_add_test(stack)
ryml_add_test(filter)
Expand Down
29 changes: 29 additions & 0 deletions test/test_version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef RYML_SINGLE_HEADER
#include "c4/yml/version.hpp"
#endif
#include "./test_lib/test_case.hpp"
#include <gtest/gtest.h>

TEST(version, str)
{
c4::csubstr v = c4::yml::version();
EXPECT_GE(v.len, 5);
}

TEST(version, major)
{
int v = c4::yml::version_major();
EXPECT_GE(v, 0);
}

TEST(version, minor)
{
int v = c4::yml::version_minor();
EXPECT_GE(v, 0);
}

TEST(version, patch)
{
int v = c4::yml::version_patch();
EXPECT_GE(v, 0);
}
2 changes: 2 additions & 0 deletions tools/amalgamate.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def amalgamate_ryml(filename: str,
am.onlyif(with_c4core, c4core_amalgamated),
"src/c4/yml/export.hpp",
"src/c4/yml/fwd.hpp",
"src/c4/yml/version.hpp",
"src/c4/yml/common.hpp",
"src/c4/yml/node_type.hpp",
"src/c4/yml/tag.hpp",
Expand All @@ -110,6 +111,7 @@ def amalgamate_ryml(filename: str,
am.onlyif(with_stl, "src/c4/yml/std/string.hpp"),
am.onlyif(with_stl, "src/c4/yml/std/vector.hpp"),
am.onlyif(with_stl, "src/c4/yml/std/std.hpp"),
"src/c4/yml/version.cpp",
"src/c4/yml/common.cpp",
"src/c4/yml/node_type.cpp",
"src/c4/yml/tag.cpp",
Expand Down

0 comments on commit cbbe95f

Please sign in to comment.