ublox-at-cellular-interface-ext

Dependencies:   ublox-at-cellular-interface

Revision:
11:3631f62bb359
Parent:
5:9fd89567f769
Child:
27:12b47e78f601
diff -r 3b24bc50cc06 -r 3631f62bb359 TESTS/unit_tests/ftp/main.cpp
--- a/TESTS/unit_tests/ftp/main.cpp	Tue Jun 13 10:46:08 2017 +0100
+++ b/TESTS/unit_tests/ftp/main.cpp	Fri Jun 16 00:55:19 2017 +0100
@@ -51,11 +51,16 @@
 //      }
 //}
 
+// 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
-// 8944501104169548380.
-# define MBED_CONF_APP_DEFAULT_PIN "5134"
+// Note: if PIN is enabled on your SIM, you must define the PIN
+// for your SIM jere (e.g. using mbed_app.json to do so).
+# define MBED_CONF_APP_DEFAULT_PIN "0000"
 #endif
 
 // Network credentials.
@@ -116,6 +121,7 @@
 #  define MBED_CONF_APP_FTP_FILENAME "test_file_delete_me"
 # endif
 // The name of the directory to create, CD to and then remove
+// Must not be a substring of MBED_CONF_APP_FTP_FILENAME.
 # ifndef MBED_CONF_APP_FTP_DIRNAME
 #  define MBED_CONF_APP_FTP_DIRNAME "test_dir_delete_me"
 # endif
@@ -132,7 +138,7 @@
 
 // The size of file when testing PUT/GET
 #ifndef MBED_CONF_APP_FTP_FILE_SIZE
-#  define MBED_CONF_APP_FTP_FILE_SIZE 42000
+#  define MBED_CONF_APP_FTP_FILE_SIZE 1200
 #endif
 
 // ----------------------------------------------------------------
@@ -148,7 +154,7 @@
 static UbloxATCellularInterfaceExt *pDriver =
        new UbloxATCellularInterfaceExt(MDMTXD, MDMRXD,
                                        MBED_CONF_UBLOX_CELL_BAUD_RATE,
-                                       true);
+                                       MBED_CONF_APP_DEBUG_ON);
 // A buffer for general use
 static char buf[MBED_CONF_APP_FTP_FILE_SIZE];
 
@@ -209,7 +215,7 @@
     TEST_ASSERT(pDriver->init(MBED_CONF_APP_DEFAULT_PIN));
 
     // Reset parameters to default to begin with
-    TEST_ASSERT(pDriver->ftpResetPar());
+    pDriver->ftpResetPar();
 
     // Set a timeout for FTP commands
     TEST_ASSERT(pDriver->ftpSetTimeout(60000));
@@ -251,7 +257,7 @@
 void test_ftp_dir() {
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The file we will GET should appear in the directory listing
@@ -264,7 +270,7 @@
 void test_ftp_fileinfo() {
     // Get the info
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_FILE_INFO,
-                                    MBED_CONF_APP_FTP_FILENAME, NULL, 0,
+                                    MBED_CONF_APP_FTP_FILENAME, NULL,
                                     buf, sizeof (buf)) == NULL);
     tr_debug("File info:\n%s", buf);
 
@@ -310,7 +316,7 @@
 void test_ftp_rename() {
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The file we are renaming to should not appear
@@ -323,7 +329,7 @@
 
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The new file should now exist
@@ -335,7 +341,7 @@
 void test_ftp_delete() {
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The file we are to delete should appear in the list
@@ -347,7 +353,7 @@
 
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The file we deleted should no longer appear in the list
@@ -358,7 +364,7 @@
 void test_ftp_mkdir() {
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The directory we are to create should not appear in the list
@@ -370,7 +376,7 @@
 
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The directory we created should now appear in the list
@@ -381,7 +387,7 @@
 void test_ftp_rmdir() {
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The directory we are to remove should appear in the list
@@ -393,7 +399,7 @@
 
     // Get a directory listing
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The directory we removed should no longer appear in the list
@@ -422,7 +428,7 @@
     // Get a directory listing
     *buf = 0;
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
 
     tr_debug("Listing:\n%s", buf);
 
@@ -435,7 +441,7 @@
     // Get a directory listing
     *buf = 0;
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The listing should no longer include the directory name we have moved
@@ -448,7 +454,7 @@
     // Get a directory listing
     *buf = 0;
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_LS,
-                                    NULL, NULL, 0, buf, sizeof (buf)) == NULL);
+                                    NULL, NULL, buf, sizeof (buf)) == NULL);
     tr_debug("Listing:\n%s", buf);
 
     // The listing should include the directory name we went to once more
@@ -463,7 +469,7 @@
     // Do FOTA on a file
     TEST_ASSERT(pDriver->ftpCommand(UbloxATCellularInterfaceExt::FTP_FOTA_FILE,
                                     MBED_CONF_APP_FTP_FOTA_FILENAME, NULL,
-                                    0, buf, sizeof (buf)) == NULL);
+                                    buf, sizeof (buf)) == NULL);
     tr_debug("MD5 sum: %s\n", buf);
 
     // Check that the 128 bit MD5 sum is now there
@@ -502,8 +508,7 @@
     Case("FTP file info", test_ftp_fileinfo),
     Case("FTP rename", test_ftp_rename),
     Case("FTP make directory", test_ftp_mkdir),
-    Case("FTP directory list", test_ftp_dir),
-    Case("FTP delete", test_ftp_delete),
+    Case("FTP directory list", test_ftp_dir),    Case("FTP delete", test_ftp_delete),
     Case("FTP change directory", test_ftp_cd),
     Case("FTP delete directory", test_ftp_rmdir),
 #else