|
Last change
on this file since d7f7a4a was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago |
|
Replace some license headers with SPDX identifier
Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.
|
-
Property mode
set to
100644
|
|
File size:
906 bytes
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * SPDX-FileCopyrightText: 2012-2013 Vojtech Horky
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #define _BSD_SOURCE
|
|---|
| 8 | #define _DEFAULT_SOURCE
|
|---|
| 9 |
|
|---|
| 10 | #include <pcut/pcut.h>
|
|---|
| 11 | #include <stdlib.h>
|
|---|
| 12 | #include <stdio.h>
|
|---|
| 13 |
|
|---|
| 14 | PCUT_INIT
|
|---|
| 15 |
|
|---|
| 16 | static char *buffer = NULL;
|
|---|
| 17 | #define BUFFER_SIZE 512
|
|---|
| 18 |
|
|---|
| 19 | PCUT_TEST_SUITE(suite_with_setup_and_teardown);
|
|---|
| 20 |
|
|---|
| 21 | PCUT_TEST_BEFORE {
|
|---|
| 22 | buffer = malloc(BUFFER_SIZE);
|
|---|
| 23 | PCUT_ASSERT_NOT_NULL(buffer);
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | PCUT_TEST_AFTER {
|
|---|
| 27 | free(buffer);
|
|---|
| 28 | buffer = NULL;
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | PCUT_TEST(test_with_setup_and_teardown) {
|
|---|
| 32 | #if (defined(__WIN64) || defined(__WIN32) || defined(_WIN32)) && defined(_MSC_VER)
|
|---|
| 33 | _snprintf_s(buffer, BUFFER_SIZE - 1, _TRUNCATE, "%d-%s", 56, "abcd");
|
|---|
| 34 | #else
|
|---|
| 35 | snprintf(buffer, BUFFER_SIZE - 1, "%d-%s", 56, "abcd");
|
|---|
| 36 | #endif
|
|---|
| 37 |
|
|---|
| 38 | PCUT_ASSERT_STR_EQUALS("56-abcd", buffer);
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | PCUT_TEST_SUITE(another_without_setup);
|
|---|
| 42 |
|
|---|
| 43 | PCUT_TEST(test_without_any_setup_or_teardown) {
|
|---|
| 44 | PCUT_ASSERT_NULL(buffer);
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 | PCUT_MAIN()
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.