diff --git a/.gitignore b/.gitignore index 968249e..209cd34 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -test/test-reports/ -test/*.test -test/runtest +TEST-*.xml +test_*.exec +runtest libvm68k.la libvm68kapi.la remove-potcdate.sed @@ -14,19 +14,19 @@ config.h.in configure aclocal.m4 stamp-* -**/Debug/ -**/Release/ -**/LibrarySupport/ -**/.libs/ -**/.deps/ -**/nbproject/private/ -**/_build/ +Debug +Release +.libs +.deps +LibrarySupport +_build *@quot.po *@boldquot.po *.insert-header *.gmo *.trs *.log +*.pc *.lo *.o *.tvsconfig diff --git a/.hgignore b/.hgignore index a293a96..6f5adfd 100644 --- a/.hgignore +++ b/.hgignore @@ -1,7 +1,7 @@ syntax: regexp -^test/test-reports/ -^test/[^/]*\.test$ -^test/runtest$ +(^|/)TEST-[^/]*\.xml$ +(^|/)test_[^/]*\.exec$ +(^|/)runtest$ (^|/)libvm68k\.la$ (^|/)libvm68kapi\.la$ (^|/)remove-potcdate\.sed$ @@ -15,19 +15,19 @@ syntax: regexp (^|/)configure$ (^|/)aclocal\.m4$ (^|/)stamp-[^/]*$ -(^|/)Debug/ -(^|/)Release/ -(^|/)LibrarySupport/ -(^|/)\.libs/ -(^|/)\.deps/ -(^|/)nbproject/private/ -(^|/)_build/ +(^|/)Debug$ +(^|/)Release$ +(^|/)\.libs$ +(^|/)\.deps$ +(^|/)LibrarySupport$ +(^|/)_build$ @quot\.po$ @boldquot\.po$ \.insert-header$ \.gmo$ \.trs$ \.log$ +\.pc$ \.lo$ \.o$ \.tvsconfig$ diff --git a/.hgtags b/.hgtags new file mode 100644 index 0000000..4af4d63 --- /dev/null +++ b/.hgtags @@ -0,0 +1 @@ +0b9aff908790e0dc941587209eb3a9ce1057004e release/2-alpha.1 diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 95b3bd1..255b7d6 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -1,11 +1,12 @@ { "configurations": [ { - "name": "POSIX", + "name": "POSIX (GCC)", + "compilerPath": "/usr/bin/gcc", "includePath": [ "${workspaceFolder}", "${workspaceFolder}/libvm68kapi", - "${workspaceFolder}/src" + "${workspaceFolder}/libvm68k" ], "defines": [ "HAVE_CONFIG_H" diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 37847ab..0ee1359 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -8,10 +8,7 @@ "args": [ "check" ], - "group": { - "kind": "build", - "isDefault": true - }, + "group": "build", "problemMatcher": [ "$gcc" ] @@ -24,7 +21,7 @@ "clean", "check" ], - "group": "build", + "group": "none", "problemMatcher": [ "$gcc" ] diff --git a/Makefile.am b/Makefile.am index 5c5d2ba..dfe932f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,11 @@ ## Process this file with automake to produce Makefile.in. -# Uses foreign for now. -AUTOMAKE_OPTIONS = foreign - ACLOCAL_AMFLAGS = -Im4 -SUBDIRS = config libvm68kapi src test - EXTRA_DIST = libvm68k.groupproj +SUBDIRS = libvm68kapi libvm68k test + dist-hook: $(distdir)/SHA256SUMS if test -n "$$GPG_USERNAME"; then \ gpg -ba -u "$$GPG_USERNAME" $(distdir)/SHA256SUMS; \ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a40c102..ef9fb8c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,7 +6,7 @@ # this notice are preserved. This file is offered as-is, without any warranty. --- variables: - package.distName: libvm68k-2-alpha.1 + package.distName: libvm68k-2-alpha.2 trigger: - master - release/* @@ -34,7 +34,7 @@ stages: libcppunit-dev displayName: Install build dependencies - bash: | - autoreconf --install + autoreconf displayName: Bootstrap - bash: | ./configure --disable-static diff --git a/config/Makefile.am b/config/Makefile.am deleted file mode 100644 index 05ab994..0000000 --- a/config/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -## Process this file with automake to produce Makefile.in. diff --git a/configure.ac b/configure.ac index 6f6ab3d..a2c9f46 100644 --- a/configure.ac +++ b/configure.ac @@ -1,29 +1,25 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.69]) -AC_INIT([libvm68k], [2-alpha.1], -[https://bitbucket.org/vx68k/libvm68k/issues/new],, +AC_INIT([libvm68k], [2-alpha.2], +[https://bitbucket.org/kazssym/libvm68k/issues/new],, [https://www.vx68k.org/vx68k/libvm68k]) -AC_CONFIG_SRCDIR([src/context.cpp]) +AC_CONFIG_SRCDIR([libvm68k/context.cpp]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) -AM_INIT_AUTOMAKE([no-define]) -LT_INIT - +LT_PREREQ([2.4.6]) +LT_INIT() +AM_INIT_AUTOMAKE([foreign no-define tar-ustar]) # Checks for programs. AC_PROG_CC AC_PROG_CXX - # Checks for libraries. - # Checks for header files. - # Checks for typedefs, structures, and compiler characteristics. - # Checks for library functions. PKG_CHECK_MODULES([CPPUNIT], [cppunit],, [no_cppunit=yes]) AM_CONDITIONAL([CPPUNIT], [test "$no_cppunit" != yes]) - -AC_CONFIG_FILES([Makefile config/Makefile libvm68kapi/Makefile -src/Makefile test/Makefile]) +# Configuration actions. +AC_CONFIG_FILES([Makefile libvm68kapi/Makefile libvm68k/Makefile +test/Makefile]) AC_CONFIG_HEADERS([config.h]) AC_OUTPUT diff --git a/libvm68k/Makefile.am b/libvm68k/Makefile.am new file mode 100644 index 0000000..61650d5 --- /dev/null +++ b/libvm68k/Makefile.am @@ -0,0 +1,31 @@ +## Process this file with automake to produce Makefile.in. + +AM_CPPFLAGS = -I$(top_srcdir)/config \ +-I$(top_srcdir)/libvm68kapi -I$(top_builddir)/libvm68kapi + +pkgconfigdir = $(libdir)/pkgconfig + +lib_LTLIBRARIES = libvm68k.la + +EXTRA_DIST = vm68k.pc.in vm68k.cbproj ModelSupport_vm68k + +pkgconfig_DATA = vm68k.pc + +libvm68k_la_LDFLAGS = -version-info 1:0:0 +libvm68k_la_SOURCES = context.cpp +EXTRA_libvm68k_la_SOURCES = win32dll.cpp + +nobase_include_HEADERS = \ +bits/vm68kcore.h bits/vm68k/register.h bits/vm68k/context.h +noinst_HEADERS = vm68kPCH1.h + +CLEANFILES = $(pkgconfig_DATA) + +vm68k.pc: $(srcdir)/vm68k.pc.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status --file=$(subdir)/$@ + +installcheck-local: + if test -n '$(PKG_CONFIG)'; then \ + export PKG_CONFIG_PATH=$(pkgconfigdir); \ + $(PKG_CONFIG) --exists --exact-version=$(VERSION) vm68k; \ + fi diff --git a/src/ModelSupport_vm68k/default.txaPackage b/libvm68k/ModelSupport_vm68k/default.txaPackage similarity index 100% rename from src/ModelSupport_vm68k/default.txaPackage rename to libvm68k/ModelSupport_vm68k/default.txaPackage diff --git a/src/ModelSupport_vm68k/default.txvpck b/libvm68k/ModelSupport_vm68k/default.txvpck similarity index 100% rename from src/ModelSupport_vm68k/default.txvpck rename to libvm68k/ModelSupport_vm68k/default.txvpck diff --git a/src/ModelSupport_vm68k/vm68k/default.txaPackage b/libvm68k/ModelSupport_vm68k/vm68k/default.txaPackage similarity index 100% rename from src/ModelSupport_vm68k/vm68k/default.txaPackage rename to libvm68k/ModelSupport_vm68k/vm68k/default.txaPackage diff --git a/src/ModelSupport_vm68k/vm68k/default.txvpck b/libvm68k/ModelSupport_vm68k/vm68k/default.txvpck similarity index 100% rename from src/ModelSupport_vm68k/vm68k/default.txvpck rename to libvm68k/ModelSupport_vm68k/vm68k/default.txvpck diff --git a/src/bits/vm68k/context.h b/libvm68k/bits/vm68k/context.h similarity index 100% rename from src/bits/vm68k/context.h rename to libvm68k/bits/vm68k/context.h diff --git a/src/bits/vm68k/register.h b/libvm68k/bits/vm68k/register.h similarity index 100% rename from src/bits/vm68k/register.h rename to libvm68k/bits/vm68k/register.h diff --git a/src/bits/vm68kcore.h b/libvm68k/bits/vm68kcore.h similarity index 100% rename from src/bits/vm68kcore.h rename to libvm68k/bits/vm68kcore.h diff --git a/src/context.cpp b/libvm68k/context.cpp similarity index 100% rename from src/context.cpp rename to libvm68k/context.cpp diff --git a/src/vm68k.cbproj b/libvm68k/vm68k.cbproj similarity index 100% rename from src/vm68k.cbproj rename to libvm68k/vm68k.cbproj diff --git a/libvm68k/vm68k.pc.in b/libvm68k/vm68k.pc.in new file mode 100644 index 0000000..05b9931 --- /dev/null +++ b/libvm68k/vm68k.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +libdir=@libdir@ + +Name: vm68k +Description: libvm68k +Version: @VERSION@ +Requires.private: vm68kapi +Cflags: -I${includedir} +Libs: -L${libdir} -lvm68k diff --git a/src/vm68k/context b/libvm68k/vm68k/context similarity index 100% rename from src/vm68k/context rename to libvm68k/vm68k/context diff --git a/src/vm68kPCH1.h b/libvm68k/vm68kPCH1.h similarity index 100% rename from src/vm68kPCH1.h rename to libvm68k/vm68kPCH1.h diff --git a/src/win32dll.cpp b/libvm68k/win32dll.cpp similarity index 100% rename from src/win32dll.cpp rename to libvm68k/win32dll.cpp diff --git a/libvm68kapi/Makefile.am b/libvm68kapi/Makefile.am index 7354209..d831c1c 100644 --- a/libvm68kapi/Makefile.am +++ b/libvm68kapi/Makefile.am @@ -1,12 +1,29 @@ ## Process this file with automake to produce Makefile.in. -AM_CPPFLAGS = +AM_CPPFLAGS = -D_VM68K_API_LIBRARY + +pkgconfigdir = $(libdir)/pkgconfig lib_LTLIBRARIES = libvm68kapi.la +EXTRA_DIST = vm68kapi.pc.in + +pkgconfig_DATA = vm68kapi.pc + nobase_include_HEADERS = vm68k/data vm68k/memory \ bits/vm68kapi.h bits/vm68k/data.h bits/vm68k/memory.h \ bits/vm68k/virtual_machine.h libvm68kapi_la_LDFLAGS = -version-info 1:0:0 libvm68kapi_la_SOURCES = data.cpp memory.cpp virtual_machine.cpp + +CLEANFILES = $(pkgconfig_DATA) + +vm68kapi.pc: $(srcdir)/vm68kapi.pc.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status --file=$(subdir)/$@ + +installcheck-local: + if test -n '$(PKG_CONFIG)'; then \ + export PKG_CONFIG_PATH=$(pkgconfigdir); \ + $(PKG_CONFIG) --exists --exact-version=$(VERSION) vm68kapi; \ + fi diff --git a/libvm68kapi/bits/vm68k/data.h b/libvm68kapi/bits/vm68k/data.h index d561f22..aaf5c81 100644 --- a/libvm68kapi/bits/vm68k/data.h +++ b/libvm68kapi/bits/vm68k/data.h @@ -28,7 +28,7 @@ namespace vm68k /// Byte (8-bit-wide) data. /// /// This type is trivial and standard-layout. - class _VM68KAPI_PUBLIC byte + class _VM68K_API_PUBLIC byte { public: using int_type = std::int8_t; @@ -89,7 +89,7 @@ namespace vm68k /// Word (16-bit-wide) data. /// /// This type is trivial and standard-layout. - class _VM68KAPI_PUBLIC word + class _VM68K_API_PUBLIC word { public: using int_type = std::int16_t; @@ -152,7 +152,7 @@ namespace vm68k /// Long word (32-bit-wide) data. /// /// This type is trivial and standard-layout. - class _VM68KAPI_PUBLIC long_word + class _VM68K_API_PUBLIC long_word { public: using int_type = std::int32_t; diff --git a/libvm68kapi/bits/vm68k/memory.h b/libvm68kapi/bits/vm68k/memory.h index fe73c85..8763363 100644 --- a/libvm68kapi/bits/vm68k/memory.h +++ b/libvm68kapi/bits/vm68k/memory.h @@ -30,7 +30,7 @@ namespace vm68k * Kaz Nishimura * 2.0 */ - class _VM68KAPI_PUBLIC memory + class _VM68K_API_PUBLIC memory { public: enum mode @@ -76,7 +76,7 @@ namespace vm68k }; /// Read-write memory. - class _VM68KAPI_PUBLIC read_write_memory : public memory + class _VM68K_API_PUBLIC read_write_memory : public memory { using inherited = memory; @@ -123,7 +123,7 @@ namespace vm68k * Kaz Nishimura * 2.0 */ - class _VM68KAPI_PUBLIC memory_map + class _VM68K_API_PUBLIC memory_map { public: using mode = memory::mode; @@ -152,7 +152,7 @@ namespace vm68k const void *bytes) = 0; }; - class _VM68KAPI_PUBLIC memory_exception : public std::exception { + class _VM68K_API_PUBLIC memory_exception : public std::exception { typedef std::exception inherited; public: @@ -167,7 +167,7 @@ namespace vm68k memory_map::address_type _error_address; }; - class _VM68KAPI_PUBLIC bus_error : public memory_exception { + class _VM68K_API_PUBLIC bus_error : public memory_exception { typedef memory_exception inherited; public: @@ -177,7 +177,7 @@ namespace vm68k const char *what() const noexcept override; }; - class _VM68KAPI_PUBLIC address_error : public memory_exception { + class _VM68K_API_PUBLIC address_error : public memory_exception { typedef memory_exception inherited; public: diff --git a/libvm68kapi/bits/vm68k/virtual_machine.h b/libvm68kapi/bits/vm68k/virtual_machine.h index d91e529..33ef54e 100644 --- a/libvm68kapi/bits/vm68k/virtual_machine.h +++ b/libvm68kapi/bits/vm68k/virtual_machine.h @@ -26,7 +26,7 @@ namespace vm68k { /// Abstract device. - class _VM68KAPI_PUBLIC device + class _VM68K_API_PUBLIC device { protected: device(); @@ -43,7 +43,7 @@ namespace vm68k }; /// Virtual machine. - class _VM68KAPI_PUBLIC virtual_machine + class _VM68K_API_PUBLIC virtual_machine { private: std::shared_ptr _memory_map; diff --git a/libvm68kapi/bits/vm68kapi.h b/libvm68kapi/bits/vm68kapi.h index db9330c..44d8635 100644 --- a/libvm68kapi/bits/vm68kapi.h +++ b/libvm68kapi/bits/vm68kapi.h @@ -19,24 +19,24 @@ #ifndef _VM68KAPI_H #define _VM68KAPI_H 1 -#ifndef _VM68KAPI_PUBLIC +#ifndef _VM68K_API_PUBLIC #if _WIN32 #if VM68KAPI_DLL -#define _VM68KAPI_PUBLIC __declspec(dllexport) +#define _VM68K_API_PUBLIC __declspec(dllexport) #else -#define _VM68KAPI_PUBLIC __declspec(dllimport) +#define _VM68K_API_PUBLIC __declspec(dllimport) #endif #else /* !_WIN32 */ #if defined __has_attribute #if __has_attribute(visibility) -#define _VM68KAPI_PUBLIC __attribute__((visibility("default"))) +#define _VM68K_API_PUBLIC __attribute__((visibility("default"))) #endif #endif /* defined __has_attribute */ #endif /* !_WIN32 */ #endif -#ifndef _VM68KAPI_PUBLIC -#define _VM68KAPI_PUBLIC +#ifndef _VM68K_API_PUBLIC +#define _VM68K_API_PUBLIC #endif #endif diff --git a/libvm68kapi/vm68kapi.pc.in b/libvm68kapi/vm68kapi.pc.in new file mode 100644 index 0000000..81550c8 --- /dev/null +++ b/libvm68kapi/vm68kapi.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +includedir=@includedir@ +libdir=@libdir@ + +Name: vm68kapi +Description: libvm68kapi +Version: @VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lvm68kapi diff --git a/setupkeys.sh b/setupkeys.sh index 779f4e7..b77d904 100755 --- a/setupkeys.sh +++ b/setupkeys.sh @@ -6,6 +6,12 @@ # permitted in any medium without royalty provided the copyright notice and # this notice are preserved. This file is offered as-is, without any warranty. +# This script set up GnuPG keys for automated signing. +# +# The signing keys are imported from the file given as the first parameter. +# It also reads a passphrase from the standard input for the key specified by +# the 'GPG_KEYNAME' environment variable. + export GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg} mkdir -p -m go-rwx "$GNUPGHOME" diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index ec06090..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -## Process this file with automake to produce Makefile.in. - -AM_CPPFLAGS = -I$(top_srcdir)/config \ --I$(top_srcdir)/libvm68kapi -I$(top_builddir)/libvm68kapi - -lib_LTLIBRARIES = libvm68k.la - -libvm68k_la_LDFLAGS = -version-info 1:0:0 -libvm68k_la_SOURCES = context.cpp -EXTRA_libvm68k_la_SOURCES = win32dll.cpp - -nobase_include_HEADERS = \ -bits/vm68kcore.h bits/vm68k/register.h bits/vm68k/context.h -noinst_HEADERS = vm68kPCH1.h - -EXTRA_DIST = vm68k.cbproj ModelSupport_vm68k diff --git a/test/Makefile.am b/test/Makefile.am index 6107541..5c2da46 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,45 +1,49 @@ ## Process this file with automake to produce Makefile.in. -AM_CPPFLAGS = -DTEST -I$(top_builddir)/src -I$(top_srcdir)/src \ +AM_CPPFLAGS = -DTEST -I$(top_srcdir)/libvm68k -I$(top_builddir)/libvm68k \ -I$(top_srcdir)/libvm68kapi -I$(top_builddir)/libvm68kapi AM_CXXFLAGS = $(CPPUNIT_CFLAGS) +TEST_EXTENSIONS = .exec TESTS = XFAIL_TESTS = CLEANFILES = if CPPUNIT +check_PROGRAMS = test_data.exec test_memory.exec test_context.exec check_SCRIPTS = runtest -check_PROGRAMS = data.test memory.test context.test -TEST_LOG_COMPILER = ./runtest +EXEC_TEST_LOG_COMPILER = $(SHELL) ./runtest TESTS += $(check_PROGRAMS) -XFAIL_TESTS += context.test -CLEANFILES += $(check_SCRIPTS) test-reports/* +CLEANFILES += $(check_SCRIPTS) endif EXTRA_PROGRAMS = vm68k_test +noinst_HEADERS = xmlreport.h Test_vm68kdata.h Test_vm68kmem.h -data_test_LDFLAGS = -no-install -data_test_SOURCES = testmain.cpp xmlout.cpp testdata.cpp -data_test_LDADD = $(top_builddir)/libvm68kapi/libvm68kapi.la $(CPPUNIT_LIBS) +test_data_exec_LDFLAGS = -no-install +test_data_exec_LDADD = $(top_builddir)/libvm68kapi/libvm68kapi.la \ +$(CPPUNIT_LIBS) +test_data_exec_SOURCES = main.cpp xmlreport.cpp test_data.cpp -memory_test_LDFLAGS = -no-install -memory_test_SOURCES = testmain.cpp xmlout.cpp testmemory.cpp -memory_test_LDADD = $(top_builddir)/libvm68kapi/libvm68kapi.la $(CPPUNIT_LIBS) +test_memory_exec_LDFLAGS = -no-install +test_memory_exec_LDADD = $(top_builddir)/libvm68kapi/libvm68kapi.la \ +$(CPPUNIT_LIBS) +test_memory_exec_SOURCES = main.cpp xmlreport.cpp test_memory.cpp -context_test_LDFLAGS = -no-install -context_test_SOURCES = testmain.cpp xmlout.cpp testcontext.cpp -context_test_LDADD = $(top_builddir)/src/libvm68k.la \ +test_context_exec_LDFLAGS = -no-install +test_context_exec_LDADD = $(top_builddir)/libvm68k/libvm68k.la \ $(top_builddir)/libvm68kapi/libvm68kapi.la $(CPPUNIT_LIBS) +test_context_exec_SOURCES = main.cpp xmlreport.cpp test_context.cpp vm68k_test_SOURCES = vm68k_test.cpp Test_vm68kdata.cpp Test_vm68kmem.cpp -vm68k_test_LDADD = ../src/libvm68k.la - -noinst_HEADERS = xmlout.h Test_vm68kdata.h Test_vm68kmem.h +vm68k_test_LDADD = ../libvm68k/libvm68k.la EXTRA_DIST = runtest.in vm68k_test.cbproj -runtest: runtest.in Makefile - cat < $(srcdir)/runtest.in > $@ +runtest: $(srcdir)/runtest.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status --file=$(subdir)/$@ chmod +x $@ + +clean-local: + rm -rf test-reports diff --git a/test/testmain.cpp b/test/main.cpp similarity index 95% rename from test/testmain.cpp rename to test/main.cpp index 89358d0..5168ae0 100644 --- a/test/testmain.cpp +++ b/test/main.cpp @@ -1,5 +1,5 @@ -// testmain.cpp -// Copyright (C) 2012-2019 Kaz Nishimura +// main.cpp +// Copyright (C) 2012-2020 Kaz Nishimura // // 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 @@ -23,7 +23,7 @@ #pragma hdrstop #endif -#include "xmlout.h" +#include "xmlreport.h" #include #include #include diff --git a/test/runtest.in b/test/runtest.in index 01ec163..3f40b1a 100644 --- a/test/runtest.in +++ b/test/runtest.in @@ -1,4 +1,5 @@ #!/bin/sh +# @configure_input@ test="$1" && shift diff --git a/test/testcontext.cpp b/test/test_context.cpp similarity index 57% rename from test/testcontext.cpp rename to test/test_context.cpp index 8aa5efc..c61584c 100644 --- a/test/testcontext.cpp +++ b/test/test_context.cpp @@ -1,4 +1,4 @@ -// testcontext.cpp +// test_context.cpp // Copyright (C) 2012-2019 Kaz Nishimura // // This program is free software: you can redistribute it and/or modify it @@ -30,33 +30,65 @@ #include #include -using namespace std; -using namespace vm68k; +using std::unique_ptr; +using std::shared_ptr; +using std::make_shared; using CppUnit::TestFixture; +using namespace vm68k; + +namespace +{ + class test_memory_map final : public memory_map + { + using inherited = memory_map; + + private: + unique_ptr _memory; + + public: + test_memory_map() + : _memory {new read_write_memory(0x10000)} + { + } + + public: + void read(mode mode, address_type address, size_type size, + void *buffer) override + { + _memory->read(mode, address, size, buffer); + } + + void write(mode mode, address_type address, size_type size, + const void *buffer) override + { + _memory->write(mode, address, size, buffer); + } + }; +} /* - * Tests for 'memory_map'. + * Tests for class 'context'. */ class ContextTests : public TestFixture { CPPUNIT_TEST_SUITE(ContextTests); CPPUNIT_TEST(testMemory); CPPUNIT_TEST_SUITE_END(); +private: + shared_ptr _context; + public: void setUp() override { - // auto memory = make_shared(); - // context = make_shared(move(memory)); + auto memory = make_shared(); + _context.reset(new context(memory)); } void tearDown() override { - context.reset(); + _context.reset(); } void testMemory() { - CPPUNIT_ASSERT(context->memory() != NULL); + CPPUNIT_ASSERT(_context->memory() != NULL); } - -protected: - shared_ptr context; }; CPPUNIT_TEST_SUITE_REGISTRATION(ContextTests); diff --git a/test/testdata.cpp b/test/test_data.cpp similarity index 99% rename from test/testdata.cpp rename to test/test_data.cpp index 6c41efa..98a9423 100644 --- a/test/testdata.cpp +++ b/test/test_data.cpp @@ -1,4 +1,4 @@ -// testdata.cpp +// test_data.cpp // Copyright (C) 2012-2020 Kaz Nishimura // // This program is free software: you can redistribute it and/or modify it diff --git a/test/testmemory.cpp b/test/test_memory.cpp similarity index 99% rename from test/testmemory.cpp rename to test/test_memory.cpp index 8dd457b..720c3d8 100644 --- a/test/testmemory.cpp +++ b/test/test_memory.cpp @@ -1,4 +1,4 @@ -// testmemory.cpp +// test_memory.cpp // Copyright (C) 2012-2019 Kaz Nishimura // // This program is free software: you can redistribute it and/or modify it diff --git a/test/xmlout.cpp b/test/xmlreport.cpp similarity index 98% rename from test/xmlout.cpp rename to test/xmlreport.cpp index 73be54a..2c4dd72 100644 --- a/test/xmlout.cpp +++ b/test/xmlreport.cpp @@ -1,4 +1,4 @@ -// xmlout.cpp +// xmlreport.cpp // Copyright (C) 2020 Kaz Nishimura // // This program is free software: you can redistribute it and/or modify it @@ -20,7 +20,7 @@ #include #endif -#include "xmlout.h" +#include "xmlreport.h" #include #include #include diff --git a/test/xmlout.h b/test/xmlreport.h similarity index 96% rename from test/xmlout.h rename to test/xmlreport.h index cadf802..bc9f9fa 100644 --- a/test/xmlout.h +++ b/test/xmlreport.h @@ -1,4 +1,4 @@ -// xmlout.h +// xmlreport.h // Copyright (C) 2020 Kaz Nishimura // // This program is free software: you can redistribute it and/or modify it @@ -16,8 +16,8 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -#ifndef XMLOUT_H -#define XMLOUT_H 1 +#ifndef XMLREPORT_H +#define XMLREPORT_H 1 #include #include