From 80b2e6b556c41f4020c68457f1af9e40d40863e4 Mon Sep 17 00:00:00 2001 From: rtrimana Date: Wed, 11 Apr 2018 16:01:44 -0700 Subject: [PATCH] Adding Serial printouts and completing testcase for one table and two keys. --- version2/src/C/Test.ino | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/version2/src/C/Test.ino b/version2/src/C/Test.ino index 408622c..6267214 100644 --- a/version2/src/C/Test.ino +++ b/version2/src/C/Test.ino @@ -11,15 +11,20 @@ MyVector * transStatusList; Table *t1; void setup() { - Serial.begin(); + // TODO: This test uses the Serial library + // Please install "screen" on your machine and run + // it on the serial port right after flashing the + // firmware onto the Particle board. + // e.g. sudo screen /dev/ttyACM0 + Serial.begin(); timer = TimingSingleton_getInstance(); foundError = false; transStatusList = new MyVector(); IoTString *baseurl = new IoTString("http://dc-6.calit2.uci.edu/test.iotcloud/"); - IoTString * password = new IoTString("reallysecret"); + IoTString * password = new IoTString("reallysecret"); t1 = new Table(baseurl, password, 321, -1); - t1->initTable(); - + t1->initTable(); + Serial.println("Finished table init..."); baseurl->releaseRef(); password->releaseRef(); @@ -31,10 +36,11 @@ void setup() { sprintf(buffer, "b%d", i); IoTString *ib = new IoTString(buffer); t1->createNewKey(ia, 321); - t1->createNewKey(ib, 351); + t1->createNewKey(ib, 321); ia->releaseRef(); ib->releaseRef(); } + Serial.println("Finished key generation..."); } @@ -61,9 +67,16 @@ void loop() { transStatusList->add(t1->commitTransaction()); iKeyB->releaseRef(); iValueB->releaseRef(); + + Serial.println("Added new transaction: "); + Serial.print("a"); + Serial.println(i); + Serial.print("b"); + Serial.println(i); } t1->update(); + Serial.println("Updated table..."); for (int i = 0; i < NUMBER_OF_TESTS; i++) { char buffer[80]; @@ -79,12 +92,12 @@ void loop() { IoTString *testValB1 = t1->getCommitted(iKeyB); if ((testValA1 == NULL) || (testValA1->equals(iValueA) == false)) { - // printf("Key-Value t1 incorrect: keyA\n"); + Serial.println("Key-Value t1 incorrect: keyA"); foundError = true; } if ((testValB1 == NULL) || (testValB1->equals(iValueB) == false)) { - // printf("Key-Value t1 incorrect: keyB\n"); + Serial.println("Key-Value t1 incorrect: keyB"); foundError = true; } @@ -100,16 +113,18 @@ void loop() { TransactionStatus * status = transStatusList->get(i); if (status->getStatus() != TransactionStatus_StatusCommitted) { foundError = true; -// printf("Status error\n"); + Serial.println("Status error"); } delete status; } if (foundError) { -// printf("Found Errors...\n"); - } else { + Serial.println("Found Errors..."); } delete transStatusList; delete t1; + + Serial.println("Process done... now waiting..."); + while(true) { } } -- 2.34.1