Răsfoiți Sursa

Merge pull request #79 from CapXilinx/master

Fixes build issues with CppUTest on Travis CI
Martin Melik-Merkumians 9 ani în urmă
părinte
comite
69ad228ea3

+ 5 - 6
source/src/ports/POSIX/sample_application/opener_user_conf.h

@@ -138,14 +138,13 @@ static const int kOpenerProducedDataHasRunIdleHeader = 0;
 #endif
 #else
 
-/* for release builds execute the assertion, but don't test it */
-#define OPENER_ASSERT(assertion) (assertion)
+/* for release builds remove assertion */
+#define OPENER_ASSERT(assertion)
 
-/* the above may result in "statement with no effect" warnings.
- *  If you do not use assert()s to run functions, the an empty
- *  macro can be used as below
+/* if there are any strange timing issues, you can try the version below, where the assertion is performed but the assert
+ * function is not used
  */
-//#define OPENER_ASSERT(assertion)
+//#define OPENER_ASSERT(assertion) (assertion)
 /* else if you still want assertions to stop execution but without tracing, use the following */
 //#define OPENER_ASSERT(assertion) do { if(!(assertion)) { while(1){;} } } while (0)
 /* else use standard assert() */

+ 13 - 7
source/tests/cip/cipelectronickeytest.cpp

@@ -16,7 +16,7 @@ extern "C" {
 }
 
 TEST_GROUP(CipElectronicKey) {
-  ElectronicKeyFormat4 *key = NULL;
+  ElectronicKeyFormat4 *key;
 
   void setup() {
     key = ElectronicKeyFormat4New();
@@ -29,7 +29,8 @@ TEST_GROUP(CipElectronicKey) {
 };
 
 TEST(CipElectronicKey, CreateElectronicKey) {
-  char dummyArea[kElectronicKeyFormat4Size] = {0};
+  char dummyArea[kElectronicKeyFormat4Size];
+  memset(dummyArea, 0, sizeof(dummyArea));
   MEMCMP_EQUAL(dummyArea, key, kElectronicKeyFormat4Size);
 };
 
@@ -39,7 +40,8 @@ TEST(CipElectronicKey, DeleteElectronicKey) {
 }
 
 TEST(CipElectronicKey, SetVendorID) {
-  char demoArea[kElectronicKeyFormat4Size] = {0};
+  char demoArea[kElectronicKeyFormat4Size];
+  memset(demoArea, 0, sizeof(demoArea));
   CipUint *vendor_id = (CipUint *)demoArea;
   *vendor_id = 1;
   ElectronicKeyFormat4SetVendorId(1, key);
@@ -58,7 +60,8 @@ TEST(CipElectronicKey, GetVendorID) {
 }
 
 TEST(CipElectronicKey, SetDeviceType) {
-  char demoArea[kElectronicKeyFormat4Size] = {0};
+  char demoArea[kElectronicKeyFormat4Size];
+  memset(demoArea, 0, sizeof(demoArea));
   CipUint *device_type = (CipUint *)demoArea + 1;
   *device_type = 1;
 
@@ -77,7 +80,8 @@ TEST(CipElectronicKey, GetDeviceType) {
 }
 
 TEST(CipElectronicKey, SetProductCode) {
-  char demoArea[kElectronicKeyFormat4Size] = {0};
+  char demoArea[kElectronicKeyFormat4Size];
+  memset(demoArea, 0, sizeof(demoArea));
   CipUint *product_code = (CipUint *)demoArea + 2;
   *product_code = 1;
 
@@ -96,7 +100,8 @@ TEST(CipElectronicKey, GetProductCode) {
 }
 
 TEST(CipElectronicKey, SetMajorRevisionCompatibility) {
-  char demoArea[kElectronicKeyFormat4Size] = {0};
+  char demoArea[kElectronicKeyFormat4Size];
+  memset(demoArea, 0, sizeof(demoArea));
   CipByte *major_revision_compatiblitiy = (CipByte *)demoArea + 6;
   *major_revision_compatiblitiy = 0x81;
 
@@ -126,7 +131,8 @@ TEST(CipElectronicKey, GetMajorRevisionCompatibility) {
 }
 
 TEST(CipElectronicKey, SetMinorRevision) {
-  char demoArea[kElectronicKeyFormat4Size] = {0};
+  char demoArea[kElectronicKeyFormat4Size];
+  memset(demoArea, 0, sizeof(demoArea));
   CipByte *minor_revision_compatiblitiy = (CipByte *)demoArea + 7;
   *minor_revision_compatiblitiy = 0x81;