1 | #include <t.h> |
---|
2 | |
---|
3 | T_TEST_CASE(example) |
---|
4 | { |
---|
5 | T_true(true, "test passes, no message output"); |
---|
6 | T_true(false, "test fails"); |
---|
7 | T_quiet_true(true, "quiet test passes, no output at all"); |
---|
8 | T_quiet_true(false, "quiet test fails"); |
---|
9 | T_step_true(2, true, "step test passes, no message output"); |
---|
10 | T_step_true(3, false, "step test fails"); |
---|
11 | T_assert_false(true, "this is a format %s", "string"); |
---|
12 | } |
---|
13 | |
---|
14 | #include "t-self-test.h" |
---|
15 | |
---|
16 | T_TEST_OUTPUT(example, |
---|
17 | "B:example\n" |
---|
18 | "P:0:0:UI1:test-example.c:5\n" |
---|
19 | "F:1:0:UI1:test-example.c:6:test fails\n" |
---|
20 | "F:*:0:UI1:test-example.c:8:quiet test fails\n" |
---|
21 | "P:2:0:UI1:test-example.c:9\n" |
---|
22 | "F:3:0:UI1:test-example.c:10:step test fails\n" |
---|
23 | "F:4:0:UI1:test-example.c:11:this is a format string\n" |
---|
24 | "E:example:N:5:F:4:D:0.001000\n"); |
---|
25 | |
---|
26 | /* |
---|
27 | * The license is at the end of the file to be able to use the test code and |
---|
28 | * output in examples in the documentation. This is also the reason for the |
---|
29 | * dual licensing. The license for RTEMS documentation is CC-BY-SA-4.0. |
---|
30 | */ |
---|
31 | |
---|
32 | /* |
---|
33 | * SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0 |
---|
34 | * |
---|
35 | * Copyright (C) 2018, 2019 embedded brains GmbH |
---|
36 | * |
---|
37 | * Redistribution and use in source and binary forms, with or without |
---|
38 | * modification, are permitted provided that the following conditions |
---|
39 | * are met: |
---|
40 | * 1. Redistributions of source code must retain the above copyright |
---|
41 | * notice, this list of conditions and the following disclaimer. |
---|
42 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
43 | * notice, this list of conditions and the following disclaimer in the |
---|
44 | * documentation and/or other materials provided with the distribution. |
---|
45 | * |
---|
46 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
47 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
50 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
51 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
52 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
53 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
54 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
55 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
56 | * POSSIBILITY OF SUCH DAMAGE. |
---|
57 | * |
---|
58 | * ALTERNATIVELY, this software may be distributed under the terms of the |
---|
59 | * Creative Commons Attribution-ShareAlike 4.0 International Public License as |
---|
60 | * published by Creative Commons, PO Box 1866, Mountain View, CA 94042 |
---|
61 | * (https://creativecommons.org/licenses/by-sa/4.0/legalcode). |
---|
62 | */ |
---|