Fork of ublox-at-cellular-interface to add LARA-R2 support
Fork of ublox-at-cellular-interface by
Diff: TESTS/unit_tests/default/main.cpp
- Revision:
- 12:ff6fac481487
- Parent:
- 6:63dad754c267
--- a/TESTS/unit_tests/default/main.cpp Mon Oct 30 14:48:14 2017 +0000 +++ b/TESTS/unit_tests/default/main.cpp Tue Jan 09 13:20:44 2018 +0000 @@ -489,6 +489,65 @@ // TESTS // ---------------------------------------------------------------- +// Tests of stuff in the base class +void test_base_class() { + const char *imei; + const char *meid; + const char *imsi; + const char *iccid; + int rssi; + + // Power-up the modem + interface->init(); + + // Check all of the IMEI, MEID, IMSI and ICCID calls + imei = interface->imei(); + if (imei != NULL) { + tr_debug("IMEI is %s.", imei); + } else { + TEST_ASSERT(false); + } + + meid = interface->meid(); + if (meid != NULL) { + tr_debug("MEID is %s.", meid); + } else { + TEST_ASSERT(false); + } + + imsi = interface->imsi(); + if (imsi != NULL) { + tr_debug("IMSI is %s.", imsi); + } else { + TEST_ASSERT(false); + } + + iccid = interface->iccid(); + if (iccid != NULL) { + tr_debug("ICCID is %s.", iccid); + } else { + TEST_ASSERT(false); + } + + // Check the RSSI call at least doesn't assert + rssi = interface->rssi(); + tr_debug("RSSI is %d dBm.", rssi); + + // Now connect and check that the answers for the + // static fields are the same while connected + TEST_ASSERT(interface->connect(MBED_CONF_APP_DEFAULT_PIN, MBED_CONF_APP_APN, + MBED_CONF_APP_USERNAME, MBED_CONF_APP_PASSWORD) == 0); + + TEST_ASSERT(strcmp(imei, interface->imei()) == 0); + TEST_ASSERT(strcmp(meid, interface->meid()) == 0); + TEST_ASSERT(strcmp(imsi, interface->imsi()) == 0); + TEST_ASSERT(strcmp(iccid, interface->iccid()) == 0); + + // Check that the RSSI call still doesn't assert + rssi = interface->rssi(); + tr_debug("RSSI is %d dBm.", rssi); +} + // Call srand() using the NTP server void test_set_randomise() { UDPSocket sock; @@ -1024,6 +1083,7 @@ // Test cases Case cases[] = { + Case("Base class tests", test_base_class), Case("Set randomise", test_set_randomise), #ifdef MBED_CONF_APP_ECHO_SERVER Case("UDP echo test", test_udp_echo), @@ -1072,4 +1132,3 @@ } // End Of File -