summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lily-test.c44
-rw-r--r--lily-test.h58
2 files changed, 95 insertions, 7 deletions
diff --git a/lily-test.c b/lily-test.c
index 32dc075..49adb06 100644
--- a/lily-test.c
+++ b/lily-test.c
@@ -1,3 +1,47 @@
+/****************************************************************
+ *
+ * ======== lily-test ========
+ *
+ * a midsize C unit testing library
+ * copyright (c) 2022 kate swanson (sanine)
+ *
+ * This is anti-capitalist software, released for free use by individuals and
+ * organizations that do not operate by capitalist principles.
+ *
+ * Permission is hereby granted, free of charge, to any person or
+ * organization (the "User") obtaining a copy of this software and associated
+ * documentation files (the "Software"), to use, copy, modify, merge,
+ * distribute, and/or sell copies of the Software, subject to the following conditions:
+ *
+ * 1. The above copyright notice and this permission notice shall be included
+ * in all copies or modified versions of the Software.
+ *
+ * 2. The User is one of the following:
+ * a. An individual person, laboring for themselves
+ * b. A non-profit organization
+ * c. An educational institution
+ * d. An organization that seeks shared profit for all of its members, and
+ * allows non-members to set the cost of their labor
+ *
+ * 3. If the User is an organization with owners, then all owners are workers
+ * and all workers are owners with equal equity and/or equal vote.
+ *
+ * 4. If the User is an organization, then the User is not law enforcement or
+ * military, or working for or under either.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT EXPRESS OR IMPLIED WARRANTY OF
+ * ANY KIND, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * https://anticapitalist.software/
+ * https://sanine.net
+ *
+ ****************************************************************/
+
+
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lily-test.h b/lily-test.h
index 6ada538..e2ce87f 100644
--- a/lily-test.h
+++ b/lily-test.h
@@ -1,3 +1,47 @@
+/****************************************************************
+ *
+ * ======== lily-test ========
+ *
+ * a midsize C unit testing library
+ * copyright (c) 2022 kate swanson (sanine)
+ *
+ * This is anti-capitalist software, released for free use by individuals and
+ * organizations that do not operate by capitalist principles.
+ *
+ * Permission is hereby granted, free of charge, to any person or
+ * organization (the "User") obtaining a copy of this software and associated
+ * documentation files (the "Software"), to use, copy, modify, merge,
+ * distribute, and/or sell copies of the Software, subject to the following conditions:
+ *
+ * 1. The above copyright notice and this permission notice shall be included
+ * in all copies or modified versions of the Software.
+ *
+ * 2. The User is one of the following:
+ * a. An individual person, laboring for themselves
+ * b. A non-profit organization
+ * c. An educational institution
+ * d. An organization that seeks shared profit for all of its members, and
+ * allows non-members to set the cost of their labor
+ *
+ * 3. If the User is an organization with owners, then all owners are workers
+ * and all workers are owners with equal equity and/or equal vote.
+ *
+ * 4. If the User is an organization, then the User is not law enforcement or
+ * military, or working for or under either.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT EXPRESS OR IMPLIED WARRANTY OF
+ * ANY KIND, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * https://anticapitalist.software/
+ * https://sanine.net
+ *
+ ****************************************************************/
+
+
#ifndef LILY_TEST_H
#define LILY_TEST_H
@@ -89,7 +133,7 @@ void _lily_assert_float_equal(const char *name_a, const char *name_b,
double a, double b, double epsilon, const char *location);
-#define lily_assert_float_not_equal(a, b, epsilon) \
+#define lily_assert_float_not_equal(a, b, epsilon) \
_lily_assert_float_not_equal(#a, #b, a, b, epsilon, LILY_LOCATION)
void _lily_assert_float_not_equal(const char *name_a, const char *name_b,
double a, double b, double epsilon, const char *location);
@@ -111,7 +155,7 @@ void _lily_assert_memory_equal(const char *name_a, const char *name_b,
void *a, void *b, size_t size, const char *location);
-#define lily_assert_memory_not_equal(a, b, size) \
+#define lily_assert_memory_not_equal(a, b, size) \
_lily_assert_memory_not_equal(#a, #b, a, b, size, LILY_LOCATION)
void _lily_assert_memory_not_equal(const char *name_a, const char *name_b,
void *a, void *b, size_t size, const char *location);
@@ -146,10 +190,10 @@ void lily_queue_destroy(lily_queue_t *q);
* type - the type of the value to append
* value - the value to append
*/
-#define lily_enqueue(q, type, value) \
- do { \
- type _var = value; \
- _lily_enqueue(q, sizeof(type), (uint8_t*)(&_var)); \
+#define lily_enqueue(q, type, value) \
+ do { \
+ type _var = value; \
+ _lily_enqueue(q, sizeof(type), (uint8_t*)(&_var)); \
} while(0)
void _lily_enqueue(lily_queue_t *q, size_t size, uint8_t *data);
@@ -160,7 +204,7 @@ void _lily_enqueue(lily_queue_t *q, size_t size, uint8_t *data);
* type - the type of the value to pop
* ptr - the location to store the popped value
*/
-#define lily_dequeue(q, type, ptr) \
+#define lily_dequeue(q, type, ptr) \
_lily_dequeue(q, sizeof(type), (uint8_t*) ptr)
void _lily_dequeue(lily_queue_t *q, size_t size, uint8_t *ptr);