1 /*
2 * Copyright (c) 2024 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <stdint.h>
10 #include <limits.h>
11
12 #include <zephyr/ztest.h>
13
14
15 ZTEST_SUITE(a1_1_tests, NULL, NULL, NULL, NULL, NULL);
16
17 int *ptr;
18
helper(void)19 int helper(void)
20 {
21 char *s = malloc(10);
22
23 strcpy(s, "123456789");
24 s[9] = '0';
25 free(s);
26 strcpy(s, "Hello");
27 printf("string is: %s\n", s);
28
29 return 0;
30 }
31
32 /**
33 * @brief Test Asserts
34 *
35 * This test verifies various assert macros provided by ztest.
36 *
37 */
ZTEST(a1_1_tests,test_assert)38 ZTEST(a1_1_tests, test_assert)
39 {
40 helper();
41
42 zassert_true(1, "1 was false");
43 zassert_false(0, "0 was true");
44 zassert_is_null(NULL, "NULL was not NULL");
45 zassert_not_null("foo", "\"foo\" was NULL");
46 zassert_equal(1, 1, "1 was not equal to 1");
47 zassert_equal_ptr(NULL, NULL, "NULL was not equal to NULL");
48 }
49