summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mixlib/testsuite/.arch-inventory6
-rw-r--r--mixlib/testsuite/Makefile.am6
-rw-r--r--mixlib/testsuite/mix_parser_t.c98
-rw-r--r--samples/isamixinstruction.mixal4
4 files changed, 70 insertions, 44 deletions
diff --git a/mixlib/testsuite/.arch-inventory b/mixlib/testsuite/.arch-inventory
index f2cfaf7..2703642 100644
--- a/mixlib/testsuite/.arch-inventory
+++ b/mixlib/testsuite/.arch-inventory
@@ -1,2 +1,8 @@
+junk ^(mixtypest)$
+junk ^(mixparsertest)$
+junk ^(mixinstest)$
+junk ^(mixevaltest)$
+junk ^(mixdevtest)$
+junk ^(mixvminstest)$
precious ^(Makefile)$
precious ^(Makefile\.in)$
diff --git a/mixlib/testsuite/Makefile.am b/mixlib/testsuite/Makefile.am
index 330a3e1..e297988 100644
--- a/mixlib/testsuite/Makefile.am
+++ b/mixlib/testsuite/Makefile.am
@@ -17,12 +17,16 @@ LDADD = $(top_builddir)/mixlib/libmix.a
check_PROGRAMS = mixtypest mixinstest mixvminstest mixparsertest mixdevtest mixevaltest
TESTS = $(check_PROGRAMS)
+MIXAL_FILES= "\"primes\",\"isamixinstruction\",\"tests/bt\",\"tests/cbp\",\"tests/ldan\",\"tests/stress0\",\"hello\",\"echo\","
+
+AM_CFLAGS = -DMIX_TEST_MIXAL_FILES=$(MIXAL_FILES) -DMIX_TEST_SAMPLES_DIR="\"$(top_srcdir)/samples\""
+
mixtypest_SOURCES = test.h mix_types_t.c
mixinstest_SOURCES = test.h mix_ins_t.c
mixvminstest_SOURCES = test.h mix_vm_ins_t.c
-mixparsertest_SOURCES = test.h mix_parser_t.c
mixdevtest_SOURCES = test.h mix_device_t.c
mixevaltest_SOURCES = test.h mix_eval_t.c
+mixparsertest_SOURCES = test.h mix_parser_t.c
diff --git a/mixlib/testsuite/mix_parser_t.c b/mixlib/testsuite/mix_parser_t.c
index 215fc70..4008309 100644
--- a/mixlib/testsuite/mix_parser_t.c
+++ b/mixlib/testsuite/mix_parser_t.c
@@ -1,22 +1,22 @@
/* -*-c-*- -------------- mix_parser_t.c :
* Test of mix_parser_t
* ------------------------------------------------------------------
- * Copyright (C) 2000 Free Software Foundation, Inc.
- *
+ * Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+ *
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
+ *
*/
@@ -28,57 +28,73 @@
/* #define VERBOSE_TEST */
#include "test.h"
-static const gchar * const FILES_[] = { "test1" , "taocp145"
-};
+static const gchar * const FILES_[] = {MIX_TEST_MIXAL_FILES};
static const size_t FILE_NO_ = sizeof(FILES_)/sizeof(FILES_[0]);
+
static void
-test_code_(const gchar *name)
+test_code_ (const gchar *name)
{
- mix_parser_t *parser = mix_parser_new(name);
- mix_parser_err_t err;
+
mix_code_file_t *code;
+ mix_parser_err_t err;
+
+ gchar *real_name = g_strdup_printf ("%s/%s", MIX_TEST_SAMPLES_DIR, name);
+ g_print (real_name);
+ g_print ("\n");
+
+ mix_parser_t *parser = mix_parser_new (real_name);
+
+ g_assert (parser);
+
+ err = mix_parser_compile (parser);
+
+ if (err != MIX_PERR_OK)
+ {
+ g_print (mix_parser_err_string (err));
+ g_print ("\n");
+ }
+
+ g_assert (err == MIX_PERR_OK);
+
+ err = mix_parser_write_code (parser, real_name, FALSE);
+ code = mix_code_file_new_read (real_name);
+ g_assert (code);
+
+#ifdef VERBOSE_TEST
+ g_message ("%s: Version: %d.%d", name, mix_code_file_major_version (code),
+ mix_code_file_minor_version (code));
+
+ mix_short_print (mix_code_file_get_start_addr (code), "Start address: ");
+ g_print ("\n");
+
mix_ins_desc_t ins;
-
- g_assert(parser);
- err = mix_parser_compile(parser);
- if ( err != MIX_PERR_OK ) {
- g_print(mix_parser_err_string(err));
- g_print("\n");
- }
- g_assert(err == MIX_PERR_OK);
- err = mix_parser_write_code(parser, name, FALSE);
- code = mix_code_file_new_read(name);
- g_assert(code);
- g_message("%s: Version: %d.%d", name, mix_code_file_major_version(code),
- mix_code_file_minor_version(code));
- mix_short_print(mix_code_file_get_start_addr(code), "Start address: ");
- g_print("\n");
- while ( mix_code_file_get_ins(code, &ins) ) {
- mix_ins_t i;
- mix_word_to_ins_uncheck(ins.ins, i);
- mix_short_print(ins.address, "addr: ");
- g_print(" : ");
- mix_ins_print(&i);
- g_print("\n");
- }
-
- mix_parser_delete(parser);
- mix_code_file_delete(code);
+ while (mix_code_file_get_ins (code, &ins))
+ {
+ mix_ins_t i;
+ mix_word_to_ins_uncheck (ins.ins, i);
+ mix_short_print (ins.address, "addr: ");
+ g_print (" : ");
+ mix_ins_print (&i);
+ g_print ("\n");
+ }
+#endif
+
+ mix_parser_delete (parser);
+ mix_code_file_delete (code);
+ g_free (real_name);
}
-int
+int
main(int argc, char **argv)
{
size_t k;
-
+
INIT_TEST;
for (k = 0; k < FILE_NO_; ++k)
- // test_code_(FILES_[k]);
- ;
-
+ test_code_(FILES_[k]);
return EXIT_SUCCESS;
}
diff --git a/samples/isamixinstruction.mixal b/samples/isamixinstruction.mixal
index 0815fab..b1d7f2d 100644
--- a/samples/isamixinstruction.mixal
+++ b/samples/isamixinstruction.mixal
@@ -1,5 +1,5 @@
-B EQU 1(4:4)
-BMAX EQU B-1
+BB EQU 1(4:4)
+BMAX EQU BB-1
UMAX EQU 20
TABLE NOP GOOD(BMAX)
ADD FLOAT(5:5)