ublox-cellular-driver-gen Fork
Fork of ublox-cellular-driver-gen by
Diff: TESTS/unit_tests/file-system/main.cpp
- Revision:
- 5:b935404dcf7c
- Parent:
- 3:027c9eaec52c
- Child:
- 6:804d544f8d8c
--- a/TESTS/unit_tests/file-system/main.cpp Tue Jun 13 10:45:14 2017 +0100 +++ b/TESTS/unit_tests/file-system/main.cpp Thu Jun 15 01:14:18 2017 +0100 @@ -30,6 +30,11 @@ // } //} +// Whether debug trace is on +#ifndef MBED_CONF_APP_DEBUG_ON +# define MBED_CONF_APP_DEBUG_ON false +#endif + // The credentials of the SIM in the board. #ifndef MBED_CONF_APP_DEFAULT_PIN // Note: this is the PIN for the SIM with ICCID @@ -39,7 +44,7 @@ // The size of file to use. #ifndef MBED_CONF_APP_FILE_SIZE -# define MBED_CONF_APP_FILE_SIZE 12000 +# define MBED_CONF_APP_FILE_SIZE 1500 #endif // The name of the file to use. @@ -51,14 +56,16 @@ // PRIVATE VARIABLES // ---------------------------------------------------------------- +#ifdef FEATURE_COMMON_PAL // Lock for debug prints static Mutex mtx; +#endif // An instance of the generic cellular class static UbloxCellularDriverGen *pDriver = new UbloxCellularDriverGen(MDMTXD, MDMRXD, MBED_CONF_UBLOX_CELL_BAUD_RATE, - true); + MBED_CONF_APP_DEBUG_ON); // A general purpose buffer char buf[MBED_CONF_APP_FILE_SIZE]; @@ -92,12 +99,12 @@ // Write a file to the module's file system with known contents void test_write() { - for (int x = 0; x < sizeof (buf); x++) { + for (unsigned int x = 0; x < sizeof (buf); x++) { buf[x] = (char) x; } TEST_ASSERT(pDriver->writeFile(MBED_CONF_APP_FILE_NAME, buf, sizeof (buf)) == sizeof (buf)); - TEST_ASSERT(pDriver->fileSize(MBED_CONF_APP_FILE_NAME) >= sizeof (buf)); + TEST_ASSERT(pDriver->fileSize(MBED_CONF_APP_FILE_NAME) >= (int) sizeof (buf)); tr_debug("%d bytes written to file \"%s\"", sizeof (buf), MBED_CONF_APP_FILE_NAME); } @@ -109,7 +116,7 @@ tr_debug("%d bytes read from file \"%s\"", sizeof (buf), MBED_CONF_APP_FILE_NAME); - for (int x = 0; x < sizeof (buf); x++) { + for (unsigned int x = 0; x < sizeof (buf); x++) { TEST_ASSERT(buf[x] == (char) x); } }