mbed-os

Dependents:   cobaLCDJoyMotor_Thread odometry_omni_3roda_v3 odometry_omni_3roda_v1 odometry_omni_3roda_v2 ... more

TESTS/network/wifi/main.cpp

Committer:
be_bryan
Date:
2017-12-11
Revision:
0:b74591d5ab33

File content as of revision 0:b74591d5ab33:

/*
 * Copyright (c) 2017, ARM Limited, All Rights Reserved
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "wifi_tests.h"

// Test for parameters
#if !defined(MBED_CONF_APP_AP_MAC_SECURE)      || \
    !defined(MBED_CONF_APP_AP_MAC_UNSECURE)    || \
    !defined(MBED_CONF_APP_MAX_SCAN_SIZE)      || \
    !defined(MBED_CONF_APP_WIFI_CH_SECURE)     || \
    !defined(MBED_CONF_APP_WIFI_CH_UNSECURE)   || \
    !defined(MBED_CONF_APP_WIFI_DRIVER)        || \
    !defined(MBED_CONF_APP_WIFI_PASSWORD)      || \
    !defined(MBED_CONF_APP_WIFI_RX)            || \
    !defined(MBED_CONF_APP_WIFI_SECURE_SSID)   || \
    !defined(MBED_CONF_APP_WIFI_TX)            || \
    !defined(MBED_CONF_APP_WIFI_UNSECURE_SSID)
#error [NOT_SUPPORTED] Requires parameters from mbed_app.json
#endif

using namespace utest::v1;

utest::v1::status_t test_setup(const size_t number_of_cases) {
    GREENTEA_SETUP(240, "default_auto");
    return verbose_test_setup_handler(number_of_cases);
}

// Test cases
Case cases[] = {
    Case("WIFI-CONSTRUCTOR", wifi_constructor),
    Case("WIFI-SET-CREDENTIAL", wifi_set_credential),
    Case("WIFI-SET-CHANNEL", wifi_set_channel),
    Case("WIFI-GET-RSSI", wifi_get_rssi),
    Case("WIFI-CONNECT-PARAMS-NULL", wifi_connect_params_null),
    Case("WIFI-CONNECT-PARAMS-VALID-UNSECURE", wifi_connect_params_valid_unsecure),
    Case("WIFI-CONNECT-PARAMS-VALID-SECURE", wifi_connect_params_valid_secure),
    Case("WIFI-CONNECT-PARAMS-CHANNEL", wifi_connect_params_channel),
    Case("WIFI-CONNECT-PARAMS-CHANNEL-FAIL", wifi_connect_params_channel_fail),
    Case("WIFI-CONNECT-NOCREDENTIALS", wifi_connect_nocredentials),
    Case("WIFI-CONNECT", wifi_connect),
    Case("WIFI-CONNECT-SECURE", wifi_connect_secure),
    Case("WIFI-CONNECT-SECURE-FAIL", wifi_connect_secure_fail),
    Case("WIFI-CONNECT-DISCONNECT-REPEAT", wifi_connect_disconnect_repeat),
    Case("WIFI-SCAN-NULL", wifi_scan_null),
    Case("WIFI-SCAN", wifi_scan),
};

Specification specification(test_setup, cases);

// Entry point into the tests
int main() {
    return !Harness::run(specification);
}