RASCSI/cpp/test/command_context_test.cpp
Daniel Markstedt 08194af424
Move C++ code into cpp/ dir (#941)
- Moved C++ code to cpp/ from src/raspberrypi
- Related updates to Makefile, easyinstall.sh, and the github build rules
- Removed the native X68k C code in src/x68k from the repo
2022-10-25 12:59:30 -07:00

55 lines
1.1 KiB
C++

//---------------------------------------------------------------------------
//
// SCSI Target Emulator RaSCSI Reloaded
// for Raspberry Pi
//
// Copyright (C) 2022 Uwe Seimet
//
//---------------------------------------------------------------------------
#include <gtest/gtest.h>
#include "rascsi/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"));
}