ON Semiconductor / mbed-os

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers utest_case.cpp Source File

utest_case.cpp

00001 /****************************************************************************
00002  * Copyright (c) 2015, ARM Limited, All Rights Reserved
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License"); you may
00006  * not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  * http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00013  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  ****************************************************************************
00017  */
00018 
00019  #include "utest/utest_case.h"
00020  #include "utest/utest_serial.h"
00021 
00022 using namespace utest::v1;
00023 
00024 // normal handler
00025 Case::Case(const char *description,
00026            const case_setup_handler_t setup_handler,
00027            const case_handler_t handler,
00028            const case_teardown_handler_t teardown_handler,
00029            const case_failure_handler_t failure_handler) :
00030     description(description),
00031     handler(handler),
00032     control_handler(ignore_handler),
00033     repeat_count_handler(ignore_handler),
00034     setup_handler(setup_handler),
00035     teardown_handler(teardown_handler),
00036     failure_handler(failure_handler)
00037 {}
00038 
00039 Case::Case(const char *description,
00040            const case_handler_t handler,
00041            const case_teardown_handler_t teardown_handler,
00042            const case_failure_handler_t failure_handler) :
00043     description(description),
00044     handler(handler),
00045     control_handler(ignore_handler),
00046     repeat_count_handler(ignore_handler),
00047     setup_handler(default_handler),
00048     teardown_handler(teardown_handler),
00049     failure_handler(failure_handler)
00050 {}
00051 
00052 Case::Case(const char *description,
00053            const case_handler_t handler,
00054            const case_failure_handler_t failure_handler) :
00055     description(description),
00056     handler(handler),
00057     control_handler(ignore_handler),
00058     repeat_count_handler(ignore_handler),
00059     setup_handler(default_handler),
00060     teardown_handler(default_handler),
00061     failure_handler(failure_handler)
00062 {}
00063 
00064 // control handler
00065 Case::Case(const char *description,
00066            const case_setup_handler_t setup_handler,
00067            const case_control_handler_t handler,
00068            const case_teardown_handler_t teardown_handler,
00069            const case_failure_handler_t failure_handler) :
00070     description(description),
00071     handler(ignore_handler),
00072     control_handler(handler),
00073     repeat_count_handler(ignore_handler),
00074     setup_handler(setup_handler),
00075     teardown_handler(teardown_handler),
00076     failure_handler(failure_handler)
00077 {}
00078 
00079 Case::Case(const char *description,
00080            const case_control_handler_t handler,
00081            const case_teardown_handler_t teardown_handler,
00082            const case_failure_handler_t failure_handler) :
00083     description(description),
00084     handler(ignore_handler),
00085     control_handler(handler),
00086     repeat_count_handler(ignore_handler),
00087     setup_handler(default_handler),
00088     teardown_handler(teardown_handler),
00089     failure_handler(failure_handler)
00090 {}
00091 
00092 Case::Case(const char *description,
00093            const case_control_handler_t handler,
00094            const case_failure_handler_t failure_handler) :
00095     description(description),
00096     handler(ignore_handler),
00097     control_handler(handler),
00098     repeat_count_handler(ignore_handler),
00099     setup_handler(default_handler),
00100     teardown_handler(default_handler),
00101     failure_handler(failure_handler)
00102 {}
00103 
00104 // control flow handler
00105 Case::Case(const char *description,
00106            const case_setup_handler_t setup_handler,
00107            const case_call_count_handler_t case_repeat_count_handler,
00108            const case_teardown_handler_t teardown_handler,
00109            const case_failure_handler_t failure_handler) :
00110     description(description),
00111     handler(ignore_handler),
00112     control_handler(ignore_handler),
00113     repeat_count_handler(case_repeat_count_handler),
00114     setup_handler(setup_handler),
00115     teardown_handler(teardown_handler),
00116     failure_handler(failure_handler)
00117 {}
00118 
00119 Case::Case(const char *description,
00120            const case_call_count_handler_t case_repeat_count_handler,
00121            const case_failure_handler_t failure_handler) :
00122     description(description),
00123     handler(ignore_handler),
00124     control_handler(ignore_handler),
00125     repeat_count_handler(case_repeat_count_handler),
00126     setup_handler(default_handler),
00127     teardown_handler(default_handler),
00128     failure_handler(failure_handler)
00129 {}
00130 
00131 Case::Case(const char *description,
00132            const case_call_count_handler_t case_repeat_count_handler,
00133            const case_teardown_handler_t teardown_handler,
00134            const case_failure_handler_t failure_handler) :
00135     description(description),
00136     handler(ignore_handler),
00137     control_handler(ignore_handler),
00138     repeat_count_handler(case_repeat_count_handler),
00139     setup_handler(default_handler),
00140     teardown_handler(teardown_handler),
00141     failure_handler(failure_handler)
00142 {}
00143 
00144 const char*
00145 Case::get_description() const {
00146     return description;
00147 }
00148 
00149 bool
00150 Case::is_empty () const {
00151     return !(handler || control_handler || repeat_count_handler || setup_handler || teardown_handler);
00152 }