mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-10 02:29:33 +00:00
05db0e4688
* Fixing SonarCloud issues, first round * Fixing SonarCLoud issues, next round * Fixing SonarQube issues, next round * Fixed warning * Replaced empty constructors/destructors with = default; * Fixed warning * Replaced new * Use constants instead of macros * Use structured binding declarations * Use init statements for if * Use string views * Use enum class, use using instead of typedef * Fixed more SonarCloud warnings * Replaced redundant/duplicate types with auto * Devlared methods const * Memory management update * Fixed warning * Added missing const * Improved RaScsiResponse memory management * Improved memory management * Improved memory management * Replaced macros by constants, removed unused constants * Made member private * Fixed warning * Added comment * Fixed shadowing warnings * Cleanup * Cleanup * Cleanup * Fixed shadowing warning * Removed unused code * Fixed more warnings * Removed obsolete casts * Fixed warnings * Removed unused field * Removed library not needed by rasctl * Include cleanup * Updated platform check for better compatibility * Improved check for invalid option. This prevents rasctl to break on macos. * Updated option check * Fixed typo * Added TODO * Removed macro * Scope update * Replaced macro * Added TODO, update memory management * Fixed typo * Replaced NULL by nullptr * Use more structured bindings * Added TODO * Use calloc instead of mallco to not need memset * Fixed warnings * Fixed SonarQube initialization issues * Fixed warning * Cleaned up override/virtual/final * Fixed warnings * Constructor update * Fixed tests * Improved memory management * Added missing const * Added const * Fixed two bugs reported by SonarCloud * Fix SonarCloud hotspot * Fixed memory management * Memory management update * Addressing hotspot by using strncpy * Fixed SonarCloud issues * Fixed SonarQube issues * Added missing const * Added const * Added const * Suppress false positive * Added SonarQube suppressions for false positives * Added suppresoin * Fixed code smells * Reverted changes that is a SonarQube issue, but caused problems with -O3 * Removed TODO based on review
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include "testing.h"
|
|
#include "rascsi_exceptions.h"
|
|
#include "devices/device.h"
|
|
|
|
class TestDevice : public Device
|
|
{
|
|
public:
|
|
|
|
TestDevice() : Device("test") {}
|
|
~TestDevice() = default;
|
|
|
|
bool Dispatch() { return false; }
|
|
};
|
|
|
|
TEST(DeviceTest, ProductData)
|
|
{
|
|
TestDevice device;
|
|
|
|
EXPECT_THROW(device.SetVendor(""), illegal_argument_exception);
|
|
EXPECT_THROW(device.SetVendor("123456789"), illegal_argument_exception);
|
|
device.SetVendor("12345678");
|
|
EXPECT_EQ("12345678", device.GetVendor());
|
|
|
|
EXPECT_THROW(device.SetProduct(""), illegal_argument_exception);
|
|
EXPECT_THROW(device.SetProduct("12345678901234567"), illegal_argument_exception);
|
|
device.SetProduct("1234567890123456");
|
|
EXPECT_EQ("1234567890123456", device.GetProduct());
|
|
|
|
EXPECT_THROW(device.SetRevision(""), illegal_argument_exception);
|
|
EXPECT_THROW(device.SetRevision("12345"), illegal_argument_exception);
|
|
device.SetRevision("1234");
|
|
EXPECT_EQ("1234", device.GetRevision());
|
|
|
|
device.SetVendor("V");
|
|
device.SetProduct("P");
|
|
device.SetRevision("R");
|
|
|
|
EXPECT_EQ("V P R ", device.GetPaddedName());
|
|
}
|