|
| 1 | + |
| 2 | +/* mbed Microcontroller Library |
| 3 | + * Copyright (c) 2018 ARM Limited |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +#include "greentea-client/test_env.h" |
| 19 | +#include "unity/unity.h" |
| 20 | +#include "utest/utest.h" |
| 21 | + |
| 22 | +#include "mbed.h" |
| 23 | + |
| 24 | +#if !defined(MBED_SYS_STATS_ENABLED) |
| 25 | +#error [NOT_SUPPORTED] test not supported |
| 26 | +#endif |
| 27 | + |
| 28 | +using namespace utest::v1; |
| 29 | + |
| 30 | +void test_sys_info() |
| 31 | +{ |
| 32 | + mbed_stats_sys_t stats; |
| 33 | + mbed_stats_sys_get(&stats); |
| 34 | + |
| 35 | + TEST_ASSERT_NOT_EQUAL(0, stats.cpu_id); |
| 36 | +#if defined(__IAR_SYSTEMS_ICC__) |
| 37 | + TEST_ASSERT_EQUAL(IAR, stats.compiler_id); |
| 38 | +#elif defined(__CC_ARM) |
| 39 | + TEST_ASSERT_EQUAL(ARM, stats.compiler_id); |
| 40 | +#elif defined(__GNUC__) |
| 41 | + TEST_ASSERT_EQUAL(GCC_ARM, stats.compiler_id); |
| 42 | +#endif |
| 43 | + TEST_ASSERT_NOT_EQUAL(0, stats.compiler_version); |
| 44 | +} |
| 45 | + |
| 46 | +Case cases[] = { |
| 47 | + Case("Test Sys Info", test_sys_info) |
| 48 | +}; |
| 49 | + |
| 50 | +utest::v1::status_t greentea_test_setup(const size_t number_of_cases) |
| 51 | +{ |
| 52 | + GREENTEA_SETUP(20, "default_auto"); |
| 53 | + return greentea_test_setup_handler(number_of_cases); |
| 54 | +} |
| 55 | + |
| 56 | +Specification specification(greentea_test_setup, cases, greentea_test_teardown_handler); |
| 57 | + |
| 58 | +int main() |
| 59 | +{ |
| 60 | + Harness::run(specification); |
| 61 | +} |
0 commit comments