From a51707a474693a5205fc65af2d44d4b7cb405dcb Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 12 May 2004 01:11:17 +0000 Subject: [PATCH] Check in some initial infrastructure for the dpas-based test suite. --- ChangeLog | 4 ++++ Makefile.am | 2 +- configure.in | 1 + tests/.cvsignore | 6 ++++++ tests/Makefile.am | 3 +++ tests/coerce.pas | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tests/.cvsignore create mode 100644 tests/Makefile.am create mode 100644 tests/coerce.pas diff --git a/ChangeLog b/ChangeLog index 9e82f76..c965634 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,10 @@ * dpas/dpas-scanner.l (dpas_parse_hex): ignore the 'H' on the end of a hexadecimal constant. + * Makefile.am, configure.in, tests/.cvsignore, tests/Makefile.am, + tests/coerce.pas: check in some initial infrastructure for the + dpas-based test suite. + 2004-05-11 Rhys Weatherley * include/jit/jit-insn.h, jit/jit-insn.c, jit/jit-interp.cpp, diff --git a/Makefile.am b/Makefile.am index bdd5ba5..baf1fc5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,2 +1,2 @@ -SUBDIRS = include tools jit jitdynamic jitplus dpas tutorial doc +SUBDIRS = include tools jit jitdynamic jitplus dpas tutorial tests doc diff --git a/configure.in b/configure.in index 1389504..1006389 100644 --- a/configure.in +++ b/configure.in @@ -397,4 +397,5 @@ jitdynamic/Makefile jitplus/Makefile dpas/Makefile tutorial/Makefile +tests/Makefile doc/Makefile]) diff --git a/tests/.cvsignore b/tests/.cvsignore new file mode 100644 index 0000000..6e5ca7e --- /dev/null +++ b/tests/.cvsignore @@ -0,0 +1,6 @@ +Makefile +Makefile.in +.deps +.libs +*.lo +*.la diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..c8e1bbd --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,3 @@ + +TESTS = coerce.pas +TESTS_ENVIRONMENT = $(top_builddir)/dpas/dpas diff --git a/tests/coerce.pas b/tests/coerce.pas new file mode 100644 index 0000000..caf7e6f --- /dev/null +++ b/tests/coerce.pas @@ -0,0 +1,53 @@ +(* + * coerce.pas - Test type coercion of the primitive operators. + * + * Copyright (C) 2004 Southern Storm Software, Pty Ltd. + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + *) + +program coerce; + +var + failed: boolean; + +procedure run(msg: string; value: boolean); +begin + Write(msg); + Write(" ... "); + if value then begin + WriteLn("ok"); + end else begin + WriteLn("failed"); + failed := True; + end; +end; + +procedure run_tests; +begin + run("coerce_int_int", SameType(Integer, 3 + 4)); + run("coerce_int_uint", SameType(Integer, 3 + 0FFFFFFFFH)); + run("coerce_uint_uint", SameType(Cardinal, 080000000H + 0FFFFFFFFH)); + run("coerce_int_long", SameType(LongInt, 3 / 07FFFFFFFFFFFH)); + run("coerce_long_int", SameType(LongInt, 07FFFFFFFFFFFH * 3)); +end; + +begin + failed := False; + run_tests; + if failed then begin + Terminate(1); + end; +end. -- 2.47.3