aboutsummaryrefslogtreecommitdiffstats
path: root/libnormalform_evaluate.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2024-07-19 01:29:42 +0200
committerMattias Andrée <maandree@kth.se>2024-07-19 01:29:42 +0200
commit4294ec0ed06ee34920c9edaeebaeb8b65c720791 (patch)
treee0cded59452597c04fb38f403745a384675cb5f9 /libnormalform_evaluate.c
downloadlibnormalform-4294ec0ed06ee34920c9edaeebaeb8b65c720791.tar.gz
libnormalform-4294ec0ed06ee34920c9edaeebaeb8b65c720791.tar.bz2
libnormalform-4294ec0ed06ee34920c9edaeebaeb8b65c720791.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libnormalform_evaluate.c')
-rw-r--r--libnormalform_evaluate.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/libnormalform_evaluate.c b/libnormalform_evaluate.c
new file mode 100644
index 0000000..80749ed
--- /dev/null
+++ b/libnormalform_evaluate.c
@@ -0,0 +1,44 @@
+/* See LICENSE file for copyright and license details. */
+#include "common.h"
+#ifndef TEST
+
+
+int
+(libnormalform_evaluate)(LIBNORMALFORM_SENTENCE *this)
+{
+ return this->evaluate(this, NULL);
+}
+
+
+#else
+
+
+#define EVALUATION_RESULT 5
+
+static LIBNORMALFORM_SENTENCE *evaluation_this;
+
+static int
+evaluation(LIBNORMALFORM_SENTENCE *this, void *input)
+{
+ ASSERT(this);
+ ASSERT(this == evaluation_this);
+ ASSERT(input == NULL);
+ return EVALUATION_RESULT;
+}
+
+
+int
+main(void)
+{
+ TEST_BEGIN;
+
+ LIBNORMALFORM_SENTENCE a;
+ evaluation_this = &a;
+ a.evaluate = &evaluation;
+ ASSERT(libnormalform_evaluate(&a) == EVALUATION_RESULT);
+
+ TEST_END;
+}
+
+
+#endif