-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
- Add header `c4/version.hpp`: | ||
- `c4::version()` | ||
- `c4::version_major()` | ||
- `c4::version_minor()` | ||
- `c4::version_patch()` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "c4/version.hpp" | ||
|
||
namespace c4 { | ||
|
||
const char* version() | ||
{ | ||
return C4CORE_VERSION; | ||
} | ||
|
||
int version_major() | ||
{ | ||
return C4CORE_VERSION_MAJOR; | ||
} | ||
|
||
int version_minor() | ||
{ | ||
return C4CORE_VERSION_MINOR; | ||
} | ||
|
||
int version_patch() | ||
{ | ||
return C4CORE_VERSION_PATCH; | ||
} | ||
|
||
} // namespace c4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef _C4_VERSION_HPP_ | ||
#define _C4_VERSION_HPP_ | ||
|
||
/** @file version.hpp */ | ||
|
||
#define C4CORE_VERSION "0.2.3" | ||
#define C4CORE_VERSION_MAJOR 0 | ||
#define C4CORE_VERSION_MINOR 2 | ||
#define C4CORE_VERSION_PATCH 3 | ||
|
||
#include <c4/export.hpp> | ||
|
||
namespace c4 { | ||
|
||
C4CORE_EXPORT const char* version(); | ||
C4CORE_EXPORT int version_major(); | ||
C4CORE_EXPORT int version_minor(); | ||
C4CORE_EXPORT int version_patch(); | ||
|
||
} // namespace c4 | ||
|
||
#endif /* _C4_VERSION_HPP_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "c4/test.hpp" | ||
#ifndef C4CORE_SINGLE_HEADER | ||
#include "c4/version.hpp" | ||
#endif | ||
|
||
TEST_CASE("version.major") | ||
{ | ||
int v = c4::version_major(); | ||
CHECK_GE(v, 0); | ||
CHECK_EQ(v, C4CORE_VERSION_MAJOR); | ||
} | ||
|
||
TEST_CASE("version.minor") | ||
{ | ||
int v = c4::version_minor(); | ||
CHECK_GE(v, 0); | ||
CHECK_EQ(v, C4CORE_VERSION_MINOR); | ||
} | ||
|
||
TEST_CASE("version.patch") | ||
{ | ||
int v = c4::version_patch(); | ||
CHECK_GE(v, 0); | ||
CHECK_EQ(v, C4CORE_VERSION_PATCH); | ||
} | ||
|
||
TEST_CASE("version.str") | ||
{ | ||
c4::csubstr v = c4::to_csubstr(c4::version()); | ||
CHECK_GE(v.len, 5); | ||
CHECK_EQ(v, C4_XQUOTE(C4CORE_VERSION_MAJOR) "." C4_XQUOTE(C4CORE_VERSION_MINOR) "." C4_XQUOTE(C4CORE_VERSION_PATCH) ""); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters