1 /*
2  * Copyright (c) 2024 Embeint Inc
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <string.h>
8 
9 #include <zephyr/ztest.h>
10 #include <zephyr/kernel_version.h>
11 
12 #include "app_version.h"
13 
ZTEST(app_version,test_basic_ints)14 ZTEST(app_version, test_basic_ints)
15 {
16 	/* From VERSION */
17 	zassert_equal(5, APP_VERSION_MAJOR);
18 	zassert_equal(6, APP_VERSION_MINOR);
19 	zassert_equal(7, APP_PATCHLEVEL);
20 	zassert_equal(89, APP_TWEAK);
21 	zassert_equal(0x050607, APP_VERSION_NUMBER);
22 }
23 
ZTEST(app_version,test_appversion)24 ZTEST(app_version, test_appversion)
25 {
26 	/* From the APPVERSION value */
27 	zassert_equal(5, SYS_KERNEL_VER_MAJOR(APPVERSION));
28 	zassert_equal(6, SYS_KERNEL_VER_MINOR(APPVERSION));
29 	zassert_equal(7, SYS_KERNEL_VER_PATCHLEVEL(APPVERSION));
30 }
31 
ZTEST(app_version,test_basic_strings)32 ZTEST(app_version, test_basic_strings)
33 {
34 	zassert_equal(0, strcmp("5.6.7-development", APP_VERSION_STRING));
35 	zassert_equal(0, strcmp("5.6.7-development+89", APP_VERSION_EXTENDED_STRING));
36 	zassert_equal(0, strcmp("5.6.7+89", APP_VERSION_TWEAK_STRING));
37 }
38 
39 ZTEST_SUITE(app_version, NULL, NULL, NULL, NULL, NULL);
40