mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-20 00:29:18 +00:00
* Fixed TODOs, updated SCBR and SCDP * Introduced ByteWriter interface * Use accessors instead of directly accessing length/block fields
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "hal/gpiobus.h"
|
|
#include <unordered_set>
|
|
|
|
TEST(GpioBusTest, GetCommandByteCount)
|
|
{
|
|
unordered_set<int> opcodes;
|
|
|
|
EXPECT_EQ(16, GPIOBUS::GetCommandByteCount(0x88));
|
|
opcodes.insert(0x88);
|
|
EXPECT_EQ(16, GPIOBUS::GetCommandByteCount(0x8a));
|
|
opcodes.insert(0x8a);
|
|
EXPECT_EQ(16, GPIOBUS::GetCommandByteCount(0x8f));
|
|
opcodes.insert(0x8f);
|
|
EXPECT_EQ(16, GPIOBUS::GetCommandByteCount(0x91));
|
|
opcodes.insert(0x91);
|
|
EXPECT_EQ(16, GPIOBUS::GetCommandByteCount(0x9e));
|
|
opcodes.insert(0x9e);
|
|
EXPECT_EQ(16, GPIOBUS::GetCommandByteCount(0x9f));
|
|
opcodes.insert(0x9f);
|
|
EXPECT_EQ(12, GPIOBUS::GetCommandByteCount(0xa0));
|
|
opcodes.insert(0xa0);
|
|
|
|
for (int i = 0x20; i <= 0x7d; i++) {
|
|
EXPECT_EQ(10, GPIOBUS::GetCommandByteCount(i));
|
|
opcodes.insert(i);
|
|
}
|
|
|
|
for (int i = 0; i < 256; i++) {
|
|
if (opcodes.find(i) == opcodes.end()) {
|
|
EXPECT_EQ(6, GPIOBUS::GetCommandByteCount(i));
|
|
}
|
|
}
|
|
}
|