mirror of
https://github.com/akuker/RASCSI.git
synced 2026-04-20 11:17:58 +00:00
Improved testability of rascsi/rasctl/scsimon/rasdump, eliminated global fields (#960)
* Moved rascsi/rasctl/scsimon/rasdump.cpp to classes (for better testability) * Moved bus.* to hal folder * Removed some global variables * Fixed code redundancies
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include "mocks.h"
|
||||
#include "bus.h"
|
||||
#include "rascsi_exceptions.h"
|
||||
#include "controllers/abstract_controller.h"
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include "mocks.h"
|
||||
#include "bus.h"
|
||||
#include "hal/bus.h"
|
||||
|
||||
TEST(BusTest, GetCommandByteCount)
|
||||
{
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
#include <gmock/gmock.h>
|
||||
|
||||
#include "test_shared.h"
|
||||
#include "bus.h"
|
||||
#include "hal/bus.h"
|
||||
#include "controllers/scsi_controller.h"
|
||||
#include "devices/primary_device.h"
|
||||
#include "devices/storage_device.h"
|
||||
|
||||
@@ -22,7 +22,7 @@ void TestSpecialDevice(const string& name)
|
||||
EXPECT_EQ("", GetParam(device, "interfaces"));
|
||||
}
|
||||
|
||||
TEST(CommandUtil, AddGetParam)
|
||||
TEST(ProtobufUtil, AddGetParam)
|
||||
{
|
||||
PbCommand command;
|
||||
SetParam(command, "key", "value");
|
||||
@@ -40,7 +40,7 @@ TEST(CommandUtil, AddGetParam)
|
||||
EXPECT_EQ("value", it->second);
|
||||
}
|
||||
|
||||
TEST(CommandUtil, ParseParameters)
|
||||
TEST(ProtobufUtil, ParseParameters)
|
||||
{
|
||||
PbDeviceDefinition device1;
|
||||
ParseParameters(device1, "a=b:c=d:e");
|
||||
@@ -48,11 +48,10 @@ TEST(CommandUtil, ParseParameters)
|
||||
EXPECT_EQ("d", GetParam(device1, "c"));
|
||||
EXPECT_EQ("", GetParam(device1, "e"));
|
||||
|
||||
// Old style parameters
|
||||
// Old style parameter
|
||||
PbDeviceDefinition device2;
|
||||
ParseParameters(device2, "a");
|
||||
EXPECT_EQ("a", GetParam(device2, "file"));
|
||||
EXPECT_EQ("a", GetParam(device2, "interfaces"));
|
||||
|
||||
TestSpecialDevice("bridge");
|
||||
TestSpecialDevice("daynaport");
|
||||
@@ -60,7 +59,7 @@ TEST(CommandUtil, ParseParameters)
|
||||
TestSpecialDevice("services");
|
||||
}
|
||||
|
||||
TEST(CommandUtil, SetPatternParams)
|
||||
TEST(ProtobufUtil, SetPatternParams)
|
||||
{
|
||||
PbCommand command1;
|
||||
SetPatternParams(command1, "file");
|
||||
|
||||
Reference in New Issue
Block a user