--- nono/vm/test_busio.cpp 2026/04/29 17:04:32 1.1.1.1 +++ nono/vm/test_busio.cpp 2026/04/29 17:04:45 1.1.1.3 @@ -1,3 +1,9 @@ +// +// nono +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt +// + #include "header.h" #include #include @@ -9,7 +15,7 @@ class IODevice { public: IODevice() {} - virtual ~IODevice() {} + virtual ~IODevice(); virtual uint64 Read8(uint32 addr) { return 0xef; } virtual uint64 Read16(uint32 addr) { @@ -33,6 +39,7 @@ class IODevice } virtual uint64 Peek8(uint32 addr) { return 0xff; } }; +IODevice::~IODevice() { } #define SELFTEST #include "busio.h" @@ -41,7 +48,7 @@ class TestByteDev : public IODevice { public: TestByteDev() {} - virtual ~TestByteDev() {} + virtual ~TestByteDev() override; static const uint32 NPORT = 4; uint32 reg[NPORT] {}; @@ -60,12 +67,13 @@ class TestByteDev : public IODevice return reg[addr]; } }; +TestByteDev::~TestByteDev() { } class TestWordDev : public IODevice { public: TestWordDev() {} - virtual ~TestWordDev() {} + virtual ~TestWordDev() override; static const uint32 NPORT = 4; uint32 reg[NPORT] {}; @@ -84,12 +92,13 @@ class TestWordDev : public IODevice return reg[addr]; } }; +TestWordDev::~TestWordDev() { } // テストデータ // expected[] の1エントリは1バイトを表す(WordDevの時も同様)。 #define E ((uint64)-1) #define F (0xff) -struct testdata { +static struct testdata { const char *name; std::vector expected; } testdata_b[] = { @@ -109,6 +118,9 @@ struct testdata { { "BusIO_EB", { E, 1, E, 2, E, 3, E, 4, E, 1, E, 2, E, 3, E, 4, } }, + { "BusIO_FB", { + F, 1, F, 2, F, 3, F, 4, F, 1, F, 2, F, 3, F, 4, + } }, { "BusIO_BFFF", { 1, F, F, F, 2, F, F, F, 3, F, F, F, 4, F, F, F, 1, F, F, F, 2, F, F, F, 3, F, F, F, 4, F, F, F, @@ -232,7 +244,8 @@ main() do_test(&testdata_b[2], new BusIO_BBBB()); do_test(&testdata_b[3], new BusIO_BE()); do_test(&testdata_b[4], new BusIO_EB()); - do_test(&testdata_b[5], new BusIO_BFFF()); + do_test(&testdata_b[5], new BusIO_FB()); + do_test(&testdata_b[6], new BusIO_BFFF()); do_test(&testdata_w[0], new BusIO_W()); do_test(&testdata_w[1], new BusIO_WW());