mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-25 05:32:20 +00:00
52c2aa474f
* Rebrand project to PiSCSI - rascsi ->piscsi - rasctl -> scsictl - rasdump -> scsidump - ras* -> piscsi* (rasutil -> piscsi_util, etc.) * Refined the formatting and wording of the app startup banner * Kept some references to rascsi and rasctl where backwards compatibility is concerned * Point to the new github repo URL Co-authored-by: nucleogenic <nr@nucleogenic.com> Co-authored-by: Uwe Seimet <Uwe.Seimet@seimet.de>
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "scsictl/scsictl_parser.h"
|
|
|
|
TEST(ScsictlParserTest, ParseOperation)
|
|
{
|
|
ScsictlParser parser;
|
|
|
|
EXPECT_EQ(ATTACH, parser.ParseOperation("A"));
|
|
EXPECT_EQ(ATTACH, parser.ParseOperation("a"));
|
|
EXPECT_EQ(DETACH, parser.ParseOperation("d"));
|
|
EXPECT_EQ(INSERT, parser.ParseOperation("i"));
|
|
EXPECT_EQ(EJECT, parser.ParseOperation("e"));
|
|
EXPECT_EQ(PROTECT, parser.ParseOperation("p"));
|
|
EXPECT_EQ(UNPROTECT, parser.ParseOperation("u"));
|
|
EXPECT_EQ(NO_OPERATION, parser.ParseOperation(""));
|
|
EXPECT_EQ(NO_OPERATION, parser.ParseOperation("xyz"));
|
|
}
|
|
|
|
TEST(ScsictlParserTest, ParseType)
|
|
{
|
|
ScsictlParser parser;
|
|
|
|
EXPECT_EQ(SCBR, parser.ParseType("SCBR"));
|
|
EXPECT_EQ(SCBR, parser.ParseType("scbr"));
|
|
EXPECT_EQ(SCCD, parser.ParseType("sccd"));
|
|
EXPECT_EQ(SCDP, parser.ParseType("scdp"));
|
|
EXPECT_EQ(SCHD, parser.ParseType("schd"));
|
|
EXPECT_EQ(SCLP, parser.ParseType("sclp"));
|
|
EXPECT_EQ(SCMO, parser.ParseType("scmo"));
|
|
EXPECT_EQ(SCRM, parser.ParseType("scrm"));
|
|
EXPECT_EQ(SCHS, parser.ParseType("schs"));
|
|
|
|
EXPECT_EQ(SCBR, parser.ParseType("B"));
|
|
EXPECT_EQ(SCBR, parser.ParseType("b"));
|
|
EXPECT_EQ(SCCD, parser.ParseType("c"));
|
|
EXPECT_EQ(SCDP, parser.ParseType("d"));
|
|
EXPECT_EQ(SCHD, parser.ParseType("h"));
|
|
EXPECT_EQ(SCLP, parser.ParseType("l"));
|
|
EXPECT_EQ(SCMO, parser.ParseType("m"));
|
|
EXPECT_EQ(SCRM, parser.ParseType("r"));
|
|
EXPECT_EQ(SCHS, parser.ParseType("s"));
|
|
|
|
EXPECT_EQ(UNDEFINED, parser.ParseType(""));
|
|
EXPECT_EQ(UNDEFINED, parser.ParseType("xyz"));
|
|
}
|