• R/O
  • SSH

libctools: Commit

This library contains code that extends and simplifies different operations
for C language based programs.


Commit MetaInfo

Revisiónc415e873fee1dd34035b578510faad48ea8e692a (tree)
Tiempo2017-01-02 11:13:50
Autors.gusarov
Commiters.gusarov

Log Message

Added version module

Cambiar Resumen

Diferencia incremental

diff -r 400429ae0324 -r c415e873fee1 include/ctools/version.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/ctools/version.h Mon Jan 02 05:13:50 2017 +0300
@@ -0,0 +1,22 @@
1+/*
2+ * @author Sergey Gusarov <laborer2008 (at) gmail.com>
3+ * @section LICENSE
4+ * This Source Code Form is subject to the terms of the Mozilla Public
5+ * License, v. 2.0. If a copy of the MPL was not distributed with this
6+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+ *
8+ * @section DESCRIPTION
9+ *
10+ */
11+
12+#pragma once
13+
14+#include "ctools/stringify.h"
15+
16+#ifdef CT_VER_STR_DOT
17+# error CT_VER_STR_DOT must be undefined
18+#endif
19+
20+
21+#define CT_VER_STR_DOT(hi, lo, build)\
22+ CT_STRINGIFY(hi) "." CT_STRINGIFY(lo) "." CT_STRINGIFY(build)
diff -r 400429ae0324 -r c415e873fee1 tests/src/test_version.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/src/test_version.c Mon Jan 02 05:13:50 2017 +0300
@@ -0,0 +1,36 @@
1+/*
2+ * @author Sergey Gusarov <laborer2008 (at) gmail.com>
3+ * @section LICENSE
4+ * This Source Code Form is subject to the terms of the Mozilla Public
5+ * License, v. 2.0. If a copy of the MPL was not distributed with this
6+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+ *
8+ * @section DESCRIPTION
9+ *
10+ */
11+
12+#include "tests/unity_headers.h"
13+
14+#include <ctools/predef/external_headers.h>
15+
16+CT_BEGIN_EXTERNAL_HEADERS
17+# include <string.h>
18+CT_END_EXTERNAL_HEADERS
19+
20+#include <ctools/version.h>
21+
22+
23+void setUp(void)
24+{
25+}
26+
27+void tearDown(void)
28+{
29+}
30+
31+void testCompile(void)
32+{
33+ const char* const kVersion = CT_VER_STR_DOT(0, 1, 20);
34+
35+ TEST_ASSERT_TRUE(strcmp(kVersion, "0.1.20") == 0);
36+}
Show on old repository browser