init
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 /* 00002 * Copyright (c) 2017, 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 #include "mbed.h" 00019 #include "greentea-client/test_env.h" 00020 #include "unity.h" 00021 #include "utest.h" 00022 #include "wifi_tests.h" 00023 00024 // Test for parameters 00025 #if defined(MBED_CONF_APP_WIFI_SECURE_SSID) 00026 #if !defined(MBED_CONF_APP_AP_MAC_SECURE) || \ 00027 !defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \ 00028 !defined(MBED_CONF_APP_WIFI_CH_SECURE) || \ 00029 !defined(MBED_CONF_APP_WIFI_DRIVER) || \ 00030 !defined(MBED_CONF_APP_WIFI_PASSWORD) || \ 00031 !defined(MBED_CONF_APP_WIFI_RX) || \ 00032 !defined(MBED_CONF_APP_WIFI_SECURE_SSID) || \ 00033 !defined(MBED_CONF_APP_WIFI_TX) || \ 00034 !defined MBED_CONF_APP_WIFI_SECURE_PROTOCOL 00035 #error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for secure connections) 00036 #endif 00037 #endif // defined(MBED_CONF_APP_WIFI_SECURE_SSID) 00038 00039 #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) 00040 #if !defined(MBED_CONF_APP_AP_MAC_UNSECURE) || \ 00041 !defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \ 00042 !defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \ 00043 !defined(MBED_CONF_APP_WIFI_DRIVER) || \ 00044 !defined(MBED_CONF_APP_WIFI_PASSWORD) || \ 00045 !defined(MBED_CONF_APP_WIFI_RX) || \ 00046 !defined(MBED_CONF_APP_WIFI_TX) || \ 00047 !defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) 00048 #error [NOT_SUPPORTED] Requires parameters from mbed_app.json (for unsecure connections) 00049 #endif 00050 #endif // defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) 00051 00052 using namespace utest::v1; 00053 00054 utest::v1::status_t test_setup(const size_t number_of_cases) { 00055 GREENTEA_SETUP(240, "default_auto"); 00056 return verbose_test_setup_handler(number_of_cases); 00057 } 00058 00059 // Test cases 00060 Case cases[] = { 00061 Case("WIFI-CONSTRUCTOR", wifi_constructor), 00062 Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials), 00063 Case("WIFI-SET-CREDENTIAL", wifi_set_credential), 00064 Case("WIFI-SET-CHANNEL", wifi_set_channel), 00065 #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) 00066 Case("WIFI-GET-RSSI", wifi_get_rssi), 00067 #endif 00068 Case("WIFI-CONNECT-PARAMS-NULL", wifi_connect_params_null), 00069 #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) 00070 Case("WIFI-CONNECT-PARAMS-VALID-UNSECURE", wifi_connect_params_valid_unsecure), 00071 #endif 00072 #if defined(MBED_CONF_APP_WIFI_SECURE_SSID) 00073 Case("WIFI-CONNECT-PARAMS-VALID-SECURE", wifi_connect_params_valid_secure), 00074 Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel), 00075 Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail), 00076 #endif 00077 #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) 00078 Case("WIFI-CONNECT", wifi_connect), 00079 #endif 00080 #if defined(MBED_CONF_APP_WIFI_SECURE_SSID) 00081 Case("WIFI-CONNECT-SECURE", wifi_connect_secure), 00082 Case("WIFI-CONNECT-SECURE-FAIL", wifi_connect_secure_fail), 00083 #endif 00084 #if defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) 00085 Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat), 00086 #endif 00087 Case("WIFI-SCAN-NULL", wifi_scan_null), 00088 #if defined(MBED_CONF_APP_WIFI_SECURE_SSID) && defined(MBED_CONF_APP_WIFI_UNSECURE_SSID) 00089 Case("WIFI-SCAN", wifi_scan), 00090 #endif 00091 }; 00092 00093 Specification specification(test_setup, cases); 00094 00095 // Entry point into the tests 00096 int main() { 00097 return !Harness::run(specification); 00098 }
Generated on Tue Jul 12 2022 13:24:57 by
1.7.2