From a0ac86f67938cc5d02be3f1f4779d26537c77b26 Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Sun, 21 Nov 2021 17:20:32 -0500 Subject: [PATCH] Minimal #define test --- makefile | 1 + test/test0001/proof.answer | 1 + test/test0001/return.c | 23 +++++++++++++++++++++++ test/test0001/run_test.sh | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 test/test0001/proof.answer create mode 100644 test/test0001/return.c create mode 100755 test/test0001/run_test.sh diff --git a/makefile b/makefile index 00c1852..2b18982 100644 --- a/makefile +++ b/makefile @@ -53,6 +53,7 @@ results: # tests test: M2-Mesoplanet ./test/test0000/run_test.sh + ./test/test0001/run_test.sh # sha256sum -c test/test.answers diff --git a/test/test0001/proof.answer b/test/test0001/proof.answer new file mode 100644 index 0000000..ddb5ddc --- /dev/null +++ b/test/test0001/proof.answer @@ -0,0 +1 @@ +ba1d093813d679dacfe729dab1bdb8d11df35ff85b7d476ed23738972842157d test/test0001/tmp/return.c diff --git a/test/test0001/return.c b/test/test0001/return.c new file mode 100644 index 0000000..3788387 --- /dev/null +++ b/test/test0001/return.c @@ -0,0 +1,23 @@ +/* Copyright (C) 2016 Jeremiah Orians + * This file is part of M2-Planet. + * + * M2-Planet is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * M2-Planet is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with M2-Planet. If not, see . + */ + +#define answer 42 + +int main() +{ + return answer; +} diff --git a/test/test0001/run_test.sh b/test/test0001/run_test.sh new file mode 100755 index 0000000..d84dc22 --- /dev/null +++ b/test/test0001/run_test.sh @@ -0,0 +1,32 @@ +#! /bin/sh +## Copyright (C) 2017 Jeremiah Orians +## Copyright (C) 2020-2021 deesix +## This file is part of M2-Planet. +## +## M2-Planet is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## M2-Planet is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with M2-Planet. If not, see . + +set -x + +TMPDIR="test/test0001/tmp" + +mkdir -p ${TMPDIR} + +# Build the test +bin/M2-Mesoplanet \ + -f test/test0001/return.c \ + -o ${TMPDIR}/return.c \ + || exit 1 + +sha256sum -c test/test0001/proof.answer || exit 2 +exit 0