mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-29 01:49:19 +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>
55 lines
1.1 KiB
C++
55 lines
1.1 KiB
C++
//---------------------------------------------------------------------------
|
|
//
|
|
// SCSI Target Emulator PiSCSI
|
|
// for Raspberry Pi
|
|
//
|
|
// Copyright (C) 2022 Uwe Seimet
|
|
//
|
|
//---------------------------------------------------------------------------
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "piscsi/command_context.h"
|
|
|
|
TEST(CommandContext, GetSerializer)
|
|
{
|
|
CommandContext context("", -1);
|
|
|
|
// There is nothing more that can be tested
|
|
context.GetSerializer();
|
|
}
|
|
|
|
TEST(CommandContext, IsValid)
|
|
{
|
|
CommandContext context("", -1);
|
|
|
|
EXPECT_FALSE(context.IsValid());
|
|
|
|
context.SetFd(1);
|
|
EXPECT_TRUE(context.IsValid());
|
|
}
|
|
|
|
TEST(CommandContext, Cleanup)
|
|
{
|
|
CommandContext context("", 0);
|
|
|
|
EXPECT_EQ(0, context.GetFd());
|
|
context.Cleanup();
|
|
EXPECT_EQ(-1, context.GetFd());
|
|
}
|
|
|
|
TEST(CommandContext, ReturnLocalizedError)
|
|
{
|
|
CommandContext context("en_US", -1);
|
|
|
|
EXPECT_FALSE(context.ReturnLocalizedError(LocalizationKey::ERROR_LOG_LEVEL));
|
|
}
|
|
|
|
TEST(CommandContext, ReturnStatus)
|
|
{
|
|
CommandContext context("", -1);
|
|
|
|
EXPECT_TRUE(context.ReturnStatus(true, "status"));
|
|
EXPECT_FALSE(context.ReturnStatus(false, "status"));
|
|
}
|