vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c in ceedling-0.21.0 vs vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c in ceedling-0.22.0
- old
+ new
@@ -1,21 +1,21 @@
-//- Copyright (c) 2010 James Grenning and Contributed to Unity Project
-/* ==========================================
- Unity Project - A Test Framework for C
- Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
- [Released under MIT License. Please refer to license.txt for details]
-========================================== */
+/* Copyright (c) 2010 James Grenning and Contributed to Unity Project
+ * ==========================================
+ * Unity Project - A Test Framework for C
+ * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
+ * [Released under MIT License. Please refer to license.txt for details]
+ * ========================================== */
#include <string.h>
#include "unity_fixture.h"
#include "unity_internals.h"
struct _UnityFixture UnityFixture;
-//If you decide to use the function pointer approach.
-//Build with -D UNITY_OUTPUT_CHAR=outputChar and include <stdio.h>
-//int (*outputChar)(int) = putchar;
+/* If you decide to use the function pointer approach.
+ * Build with -D UNITY_OUTPUT_CHAR=outputChar and include <stdio.h>
+ * int (*outputChar)(int) = putchar; */
#if !defined(UNITY_WEAK_ATTRIBUTE) && !defined(UNITY_WEAK_PRAGMA)
void setUp(void) { /*does nothing*/ }
void tearDown(void) { /*does nothing*/ }
#endif
@@ -39,11 +39,11 @@
for (r = 0; r < UnityFixture.RepeatCount; r++)
{
UnityBegin(argv[0]);
announceTestRun(r);
runAllTests();
- UNITY_PRINT_EOL();
+ if (!UnityFixture.Verbose) UNITY_PRINT_EOL();
UnityEnd();
}
return (int)Unity.TestFailures;
}
@@ -121,13 +121,12 @@
}
}
}
-//-------------------------------------------------
-//Malloc and free stuff
-//
+/*------------------------------------------------- */
+/* Malloc and free stuff */
#define MALLOC_DONT_FAIL -1
static int malloc_count;
static int malloc_fail_countdown = MALLOC_DONT_FAIL;
void UnityMalloc_StartTest(void)
@@ -148,12 +147,12 @@
void UnityMalloc_MakeMallocFailAfterCount(int countdown)
{
malloc_fail_countdown = countdown;
}
-// These definitions are always included from unity_fixture_malloc_overrides.h
-// We undef to use them or avoid conflict with <stdlib.h> per the C standard
+/* These definitions are always included from unity_fixture_malloc_overrides.h */
+/* We undef to use them or avoid conflict with <stdlib.h> per the C standard */
#undef malloc
#undef free
#undef calloc
#undef realloc
@@ -205,13 +204,10 @@
guard->size = size;
guard->guard_space = 0;
mem = (char*)&(guard[1]);
memcpy(&mem[size], end, sizeof(end));
-#ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_
- free(guard);
-#endif
return (void*)mem;
}
static int isOverrun(void* mem)
{
@@ -283,28 +279,28 @@
return NULL;
}
if (guard->size >= size) return oldMem;
-#ifdef UNITY_EXCLUDE_STDLIB_MALLOC // Optimization if memory is expandable
+#ifdef UNITY_EXCLUDE_STDLIB_MALLOC /* Optimization if memory is expandable */
if (oldMem == unity_heap + heap_index - guard->size - sizeof(end) &&
heap_index + size - guard->size <= UNITY_INTERNAL_HEAP_SIZE_BYTES)
{
- release_memory(oldMem); // Not thread-safe, like unity_heap generally
- return unity_malloc(size); // No memcpy since data is in place
+ release_memory(oldMem); /* Not thread-safe, like unity_heap generally */
+ return unity_malloc(size); /* No memcpy since data is in place */
}
#endif
newMem = unity_malloc(size);
- if (newMem == NULL) return NULL; // Do not release old memory
+ if (newMem == NULL) return NULL; /* Do not release old memory */
memcpy(newMem, oldMem, guard->size);
release_memory(oldMem);
return newMem;
}
-//--------------------------------------------------------
-//Automatic pointer restoration functions
+/*-------------------------------------------------------- */
+/*Automatic pointer restoration functions */
struct PointerPair
{
void** pointer;
void* old_value;
};
@@ -394,11 +390,11 @@
}
i++;
}
}
} else {
- // ignore unknown parameter
+ /* ignore unknown parameter */
i++;
}
}
return 0;
}
@@ -416,10 +412,10 @@
{
UnityPrint(" PASS");
UNITY_PRINT_EOL();
}
}
- else // Unity.CurrentTestFailed
+ else /* Unity.CurrentTestFailed */
{
Unity.TestFailures++;
UNITY_PRINT_EOL();
}