mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-01 19:41:48 +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
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator RaSCSI Reloaded
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include "testing.h"
|
|
#include "devices/file_support.h"
|
|
|
|
class TestFileSupport : public FileSupport
|
|
{
|
|
void Open(const Filepath&) {
|
|
// Do nothing when running unit tests
|
|
}
|
|
};
|
|
|
|
TEST(FileSupportTest, FileSupport)
|
|
{
|
|
const int ID = 1;
|
|
const int LUN = 2;
|
|
|
|
Filepath path;
|
|
path.SetPath("path");
|
|
TestFileSupport file_support;
|
|
|
|
file_support.SetPath(path);
|
|
Filepath result;
|
|
file_support.GetPath(result);
|
|
EXPECT_STREQ("path", result.GetPath());
|
|
|
|
int id;
|
|
int lun;
|
|
EXPECT_FALSE(FileSupport::GetIdsForReservedFile(path, id, lun));
|
|
|
|
file_support.ReserveFile(path, ID, LUN);
|
|
EXPECT_TRUE(FileSupport::GetIdsForReservedFile(path, id, lun));
|
|
EXPECT_EQ(ID, id);
|
|
EXPECT_EQ(LUN, lun);
|
|
|
|
file_support.UnreserveFile();
|
|
EXPECT_FALSE(FileSupport::GetIdsForReservedFile(path, id, lun));
|
|
}
|