zpp
Zephyr C++20 Framework
main.cpp
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2019 Erwin Rol <erwin@erwinrol.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6 
7 #include <zephyr/ztest.h>
8 
9 #include <zpp/fmt.hpp>
10 
11 ZTEST_SUITE(zpp_print_tests, NULL, NULL, NULL, NULL, NULL);
12 
13 ZTEST(zpp_print_tests, test_print_uint8_t)
14 {
15  uint8_t v{ 12 };
16  zpp::print("uint8_t {} == 12\n", v);
17 }
18 
19 ZTEST(zpp_print_tests, test_print_int8_t)
20 {
21  int8_t v{ -12 };
22  zpp::print("int8_t {} == -12\n", v);
23 }
24 
25 ZTEST(zpp_print_tests, test_print_uint16_t)
26 {
27  uint16_t v{ 1234 };
28  zpp::print("uint16_t {} == 1234\n", v);
29 }
30 
31 ZTEST(zpp_print_tests, test_print_int16_t)
32 {
33  int16_t v{ -1234 };
34  zpp::print("int16_t {} == -1234\n", v);
35 }
36 
37 ZTEST(zpp_print_tests, test_print_uint32_t)
38 {
39  uint32_t v{ 12345678 };
40  zpp::print("uint32_t {} == 12345678\n", v);
41 }
42 
43 ZTEST(zpp_print_tests, test_print_int32_t)
44 {
45  int32_t v{ -12345678 };
46  zpp::print("int32_t {} == -12345678\n", v);
47 }
48 
49 ZTEST(zpp_print_tests, test_print_uint64_t)
50 {
51  uint64_t v{ 12345678901011 };
52  zpp::print("uint64_t {} == 12345678901011\n", v);
53 }
54 
55 ZTEST(zpp_print_tests, test_print_int64_t)
56 {
57  int64_t v{ -12345678901011 };
58  zpp::print("int64_t {} == -12345678901011\n", v);
59 }
60 
61 ZTEST(zpp_print_tests, test_print_char)
62 {
63  char v{ 'c' };
64  zpp::print("char {} == c\n", v);
65 }
66 
67 ZTEST(zpp_print_tests, test_print_string)
68 {
69  const char* v{ "string" };
70  zpp::print("const char* {} == string\n", v);
71 }
72 
73 ZTEST(zpp_print_tests, test_print_void_ptr)
74 {
75  void* v{ (void*)0x12345678 };
76  zpp::print("void* {} == 0x12345678\n", v);
77 }
void print(const char *fmt, T_Args &&... args) noexcept
simple typesafe print function
Definition: fmt.hpp:157
ZTEST(zpp_atomic_tests, test_atomic_bitset)
Definition: main.cpp:23
ZTEST_SUITE(zpp_atomic_tests, NULL, NULL, NULL, NULL, NULL)