From 4294ec0ed06ee34920c9edaeebaeb8b65c720791 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 19 Jul 2024 01:29:42 +0200 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libnormalform_evaluate.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 libnormalform_evaluate.c (limited to 'libnormalform_evaluate.c') 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 -- cgit v1.3.1