Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:35

0001 #include <rtems/test.h>
0002 
0003 T_TEST_CASE(wrong_step)
0004 {
0005     T_plan(2);
0006     T_step_true(0, true, "all right");
0007     T_step_true(2, true, "wrong step");
0008 }
0009 
0010 T_TEST_CASE(plan_ok)
0011 {
0012     T_plan(1);
0013     T_step_true(0, true, "all right");
0014 }
0015 
0016 T_TEST_CASE(plan_failed)
0017 {
0018     T_plan(2);
0019     T_step_true(0, true, "not enough steps");
0020     T_quiet_true(true, "quiet test do not count");
0021 }
0022 
0023 T_TEST_CASE(double_plan)
0024 {
0025     T_plan(99);
0026     T_plan(2);
0027 }
0028 
0029 T_TEST_CASE(steps)
0030 {
0031     T_step(0);
0032     T_plan(3);
0033     T_step(1);
0034     T_step(2);
0035 }
0036 
0037 static T_fixture_node nested_plan_node;
0038 
0039 T_TEST_CASE(nested_plan)
0040 {
0041     T_plan(2);
0042     T_step(0);
0043     T_push_plan(&nested_plan_node, 2);
0044     T_step(0);
0045     T_step(1);
0046     T_pop_plan();
0047     T_step(1);
0048 }
0049 
0050 #include "t-self-test.h"
0051 
0052 T_TEST_OUTPUT(wrong_step,
0053 "B:wrong_step\n"
0054 "P:0:0:UI1:test-plan.c:6\n"
0055 "F:1:0:UI1:test-plan.c:7:planned step (2)\n"
0056 "E:wrong_step:N:2:F:1:D:0.001000\n");
0057 
0058 T_TEST_OUTPUT(plan_ok,
0059 "B:plan_ok\n"
0060 "P:0:0:UI1:test-plan.c:13\n"
0061 "E:plan_ok:N:1:F:0:D:0.001000\n");
0062 
0063 T_TEST_OUTPUT(plan_failed,
0064 "B:plan_failed\n"
0065 "P:0:0:UI1:test-plan.c:19\n"
0066 "F:*:0:UI1:*:*:actual steps (1), planned steps (2)\n"
0067 "E:plan_failed:N:1:F:1:D:0.001000\n");
0068 
0069 T_TEST_OUTPUT(double_plan,
0070 "B:double_plan\n"
0071 "F:*:0:UI1:*:*:planned steps (99) already set\n"
0072 "E:double_plan:N:0:F:1:D:0.001000\n");
0073 
0074 T_TEST_OUTPUT(steps,
0075 "B:steps\n"
0076 "P:0:0:UI1:test-plan.c:31\n"
0077 "P:1:0:UI1:test-plan.c:33\n"
0078 "P:2:0:UI1:test-plan.c:34\n"
0079 "E:steps:N:3:F:0:D:0.001000\n");
0080 
0081 T_TEST_OUTPUT(nested_plan,
0082 "B:nested_plan\n"
0083 "P:0:0:UI1:test-plan.c:42\n"
0084 "P:1.0:0:UI1:test-plan.c:44\n"
0085 "P:1.1:0:UI1:test-plan.c:45\n"
0086 "P:1:0:UI1:test-plan.c:47\n"
0087 "E:nested_plan:N:4:F:0:D:0.001000\n");
0088 
0089 /*
0090  * The license is at the end of the file to be able to use the test code and
0091  * output in examples in the documentation.  This is also the reason for the
0092  * dual licensing.  The license for RTEMS documentation is CC-BY-SA-4.0.
0093  */
0094 
0095 /*
0096  * SPDX-License-Identifier: BSD-2-Clause OR CC-BY-SA-4.0
0097  *
0098  * Copyright (C) 2018, 2019 embedded brains GmbH & Co. KG
0099  *
0100  * Redistribution and use in source and binary forms, with or without
0101  * modification, are permitted provided that the following conditions
0102  * are met:
0103  * 1. Redistributions of source code must retain the above copyright
0104  *    notice, this list of conditions and the following disclaimer.
0105  * 2. Redistributions in binary form must reproduce the above copyright
0106  *    notice, this list of conditions and the following disclaimer in the
0107  *    documentation and/or other materials provided with the distribution.
0108  *
0109  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0110  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0111  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0112  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0113  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0114  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0115  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0116  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0117  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0118  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0119  * POSSIBILITY OF SUCH DAMAGE.
0120  *
0121  * ALTERNATIVELY, this software may be distributed under the terms of the
0122  * Creative Commons Attribution-ShareAlike 4.0 International Public License as
0123  * published by Creative Commons, PO Box 1866, Mountain View, CA 94042
0124  * (https://creativecommons.org/licenses/by-sa/4.0/legalcode).
0125  */