Rtos API example

Committer:
marcozecchini
Date:
Sat Feb 23 12:13:36 2019 +0000
Revision:
0:9fca2b23d0ba
final commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
marcozecchini 0:9fca2b23d0ba 1 /*
marcozecchini 0:9fca2b23d0ba 2 * Copyright (c) 2017, ARM Limited, All Rights Reserved
marcozecchini 0:9fca2b23d0ba 3 * SPDX-License-Identifier: Apache-2.0
marcozecchini 0:9fca2b23d0ba 4 *
marcozecchini 0:9fca2b23d0ba 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
marcozecchini 0:9fca2b23d0ba 6 * not use this file except in compliance with the License.
marcozecchini 0:9fca2b23d0ba 7 * You may obtain a copy of the License at
marcozecchini 0:9fca2b23d0ba 8 *
marcozecchini 0:9fca2b23d0ba 9 * http://www.apache.org/licenses/LICENSE-2.0
marcozecchini 0:9fca2b23d0ba 10 *
marcozecchini 0:9fca2b23d0ba 11 * Unless required by applicable law or agreed to in writing, software
marcozecchini 0:9fca2b23d0ba 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
marcozecchini 0:9fca2b23d0ba 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
marcozecchini 0:9fca2b23d0ba 14 * See the License for the specific language governing permissions and
marcozecchini 0:9fca2b23d0ba 15 * limitations under the License.
marcozecchini 0:9fca2b23d0ba 16 */
marcozecchini 0:9fca2b23d0ba 17
marcozecchini 0:9fca2b23d0ba 18 #include "mbed.h"
marcozecchini 0:9fca2b23d0ba 19 #include "greentea-client/test_env.h"
marcozecchini 0:9fca2b23d0ba 20 #include "unity.h"
marcozecchini 0:9fca2b23d0ba 21 #include "utest.h"
marcozecchini 0:9fca2b23d0ba 22 #include "wifi_tests.h"
marcozecchini 0:9fca2b23d0ba 23
marcozecchini 0:9fca2b23d0ba 24 // Test for parameters
marcozecchini 0:9fca2b23d0ba 25 #if !defined(MBED_CONF_APP_AP_MAC_SECURE) || \
marcozecchini 0:9fca2b23d0ba 26 !defined(MBED_CONF_APP_AP_MAC_UNSECURE) || \
marcozecchini 0:9fca2b23d0ba 27 !defined(MBED_CONF_APP_MAX_SCAN_SIZE) || \
marcozecchini 0:9fca2b23d0ba 28 !defined(MBED_CONF_APP_WIFI_CH_SECURE) || \
marcozecchini 0:9fca2b23d0ba 29 !defined(MBED_CONF_APP_WIFI_CH_UNSECURE) || \
marcozecchini 0:9fca2b23d0ba 30 !defined(MBED_CONF_APP_WIFI_DRIVER) || \
marcozecchini 0:9fca2b23d0ba 31 !defined(MBED_CONF_APP_WIFI_PASSWORD) || \
marcozecchini 0:9fca2b23d0ba 32 !defined(MBED_CONF_APP_WIFI_RX) || \
marcozecchini 0:9fca2b23d0ba 33 !defined(MBED_CONF_APP_WIFI_SECURE_SSID) || \
marcozecchini 0:9fca2b23d0ba 34 !defined(MBED_CONF_APP_WIFI_TX) || \
marcozecchini 0:9fca2b23d0ba 35 !defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
marcozecchini 0:9fca2b23d0ba 36 #error [NOT_SUPPORTED] Requires parameters from mbed_app.json
marcozecchini 0:9fca2b23d0ba 37 #endif
marcozecchini 0:9fca2b23d0ba 38
marcozecchini 0:9fca2b23d0ba 39 using namespace utest::v1;
marcozecchini 0:9fca2b23d0ba 40
marcozecchini 0:9fca2b23d0ba 41 utest::v1::status_t test_setup(const size_t number_of_cases) {
marcozecchini 0:9fca2b23d0ba 42 GREENTEA_SETUP(240, "default_auto");
marcozecchini 0:9fca2b23d0ba 43 return verbose_test_setup_handler(number_of_cases);
marcozecchini 0:9fca2b23d0ba 44 }
marcozecchini 0:9fca2b23d0ba 45
marcozecchini 0:9fca2b23d0ba 46 // Test cases
marcozecchini 0:9fca2b23d0ba 47 Case cases[] = {
marcozecchini 0:9fca2b23d0ba 48 Case("WIFI-CONSTRUCTOR", wifi_constructor),
marcozecchini 0:9fca2b23d0ba 49 Case("WIFI-SET-CREDENTIAL", wifi_set_credential),
marcozecchini 0:9fca2b23d0ba 50 Case("WIFI-SET-CHANNEL", wifi_set_channel),
marcozecchini 0:9fca2b23d0ba 51 Case("WIFI-GET-RSSI", wifi_get_rssi),
marcozecchini 0:9fca2b23d0ba 52 Case("WIFI-CONNECT-PARAMS-NULL", wifi_connect_params_null),
marcozecchini 0:9fca2b23d0ba 53 Case("WIFI-CONNECT-PARAMS-VALID-UNSECURE", wifi_connect_params_valid_unsecure),
marcozecchini 0:9fca2b23d0ba 54 Case("WIFI-CONNECT-PARAMS-VALID-SECURE", wifi_connect_params_valid_secure),
marcozecchini 0:9fca2b23d0ba 55 Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel),
marcozecchini 0:9fca2b23d0ba 56 Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail),
marcozecchini 0:9fca2b23d0ba 57 Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials),
marcozecchini 0:9fca2b23d0ba 58 Case("WIFI-CONNECT", wifi_connect),
marcozecchini 0:9fca2b23d0ba 59 Case("WIFI-CONNECT-SECURE", wifi_connect_secure),
marcozecchini 0:9fca2b23d0ba 60 Case("WIFI-CONNECT-SECURE-FAIL", wifi_connect_secure_fail),
marcozecchini 0:9fca2b23d0ba 61 Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat),
marcozecchini 0:9fca2b23d0ba 62 Case("WIFI-SCAN-NULL", wifi_scan_null),
marcozecchini 0:9fca2b23d0ba 63 Case("WIFI-SCAN", wifi_scan),
marcozecchini 0:9fca2b23d0ba 64 };
marcozecchini 0:9fca2b23d0ba 65
marcozecchini 0:9fca2b23d0ba 66 Specification specification(test_setup, cases);
marcozecchini 0:9fca2b23d0ba 67
marcozecchini 0:9fca2b23d0ba 68 // Entry point into the tests
marcozecchini 0:9fca2b23d0ba 69 int main() {
marcozecchini 0:9fca2b23d0ba 70 return !Harness::run(specification);
marcozecchini 0:9fca2b23d0ba 71 }