Skip to content

Commit

Permalink
Merge pull request #174 from jeromekelleher/meson-tweak
Browse files Browse the repository at this point in the history
Add test for version number and bump to 1.0.2
  • Loading branch information
jeromekelleher authored Dec 1, 2021
2 parents 21e2835 + 94a8eb8 commit 4e9bfc2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion c/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.1
2.0.2
2 changes: 1 addition & 1 deletion c/kastore.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ to the API or ABI are introduced, i.e., the addition of a new function.
The library patch version. Incremented when any changes not relevant to the
to the API or ABI are introduced, i.e., internal refactors of bugfixes.
*/
#define KAS_VERSION_PATCH 1
#define KAS_VERSION_PATCH 2
/** @} */

#define KAS_HEADER_SIZE 64
Expand Down
7 changes: 4 additions & 3 deletions c/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ if not meson.is_subproject()
endif

# Subprojects should compile in the static library for simplicity.
inc = include_directories('.')
kastore_inc = include_directories('.')
kastore = static_library('kastore', 'kastore.c')
kastore_dep = declare_dependency(link_with : kastore, include_directories: inc)
kastore_dep = declare_dependency(link_with : kastore, include_directories: kastore_inc)

if not meson.is_subproject()

Expand All @@ -30,7 +30,8 @@ if not meson.is_subproject()
# being run from the current working directory because of the paths
# to example files.
cunit_dep = dependency('cunit')
executable('tests', ['tests.c', 'kastore.c'], dependencies: cunit_dep)
executable('tests', ['tests.c', 'kastore.c'], dependencies: cunit_dep,
c_args: ['-DMESON_VERSION="@0@"'.format(meson.project_version())])

executable('cpp_tests', ['cpp_tests.cpp'], link_with: kastore)

Expand Down
12 changes: 12 additions & 0 deletions c/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1573,6 +1573,17 @@ test_library_version(void)
CU_ASSERT_EQUAL_FATAL(version.patch, KAS_VERSION_PATCH);
}

static void
test_meson_version(void)
{
char version[100];

sprintf(
version, "%d.%d.%d", KAS_VERSION_MAJOR, KAS_VERSION_MINOR, KAS_VERSION_PATCH);
/* the MESON_VERSION define is passed in by meson when compiling */
CU_ASSERT_STRING_EQUAL(version, MESON_VERSION);
}

/*=================================================
Test suite management
=================================================
Expand Down Expand Up @@ -1685,6 +1696,7 @@ main(int argc, char **argv)
{ "test_truncated_file_correct_size", test_truncated_file_correct_size },
{ "test_all_types_n_elements", test_all_types_n_elements },
{ "test_library_version", test_library_version },
{ "test_meson_version", test_meson_version },
CU_TEST_INFO_NULL,
};

Expand Down

0 comments on commit 4e9bfc2

Please sign in to comment.