mirror of
https://github.com/nasa/fprime.git
synced 2025-12-11 04:35:25 -06:00
* NATIVE_INT_TYPE use in toString * NATIVE_INT_TYPE use in SimpleObjRegistry * NATIVE_INT_TYPE use in Asserts * NATIVE_INT_TYPE use in Fw/Comp * NATIVE_INT_TYPE use in getCapacity * NATIVE_INT_TYPE use in getEntries * NATIVE_INT_TYPE use in size/length * NATIVE_INT_TYPE use in FILE_NAME_ARG * NATIVE_INT_TYPE use in Fw (misc) * NATIVE_INT_TYPE use in identifier * NATIVE_INT_TYPE use in Fw (misc II) * POINTER_CAST in Buffer * POINTER_CAST in Serializable * sp * Removing no longer used DefaultTypes.hpp * Fixes to accomidate Fw refactor * Unit-test and CI fixes * Fixing review comments - pt 1
62 lines
1.4 KiB
C++
62 lines
1.4 KiB
C++
// ======================================================================
|
|
// \title Buffers.cpp
|
|
// \author Rob Bocchino
|
|
// \brief F Prime sequence file headers
|
|
//
|
|
// \copyright
|
|
// Copyright (C) 2009-2018 California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
// ======================================================================
|
|
|
|
#include "gtest/gtest.h"
|
|
#include "Os/File.hpp"
|
|
#include "Svc/CmdSequencer/test/ut/SequenceFiles/Buffers.hpp"
|
|
|
|
namespace Svc {
|
|
|
|
namespace SequenceFiles {
|
|
|
|
namespace Buffers {
|
|
|
|
FwSizeType FileBuffer ::
|
|
getBuffCapacity() const
|
|
{
|
|
return sizeof(m_buff);
|
|
}
|
|
|
|
U8* FileBuffer ::
|
|
getBuffAddr()
|
|
{
|
|
return m_buff;
|
|
}
|
|
|
|
const U8* FileBuffer ::
|
|
getBuffAddr() const
|
|
{
|
|
return m_buff;
|
|
}
|
|
|
|
void write(
|
|
const Fw::SerializeBufferBase& buffer,
|
|
const char* fileName
|
|
) {
|
|
Os::File file;
|
|
ASSERT_EQ(file.open(fileName, Os::File::OPEN_WRITE), Os::File::OP_OK);
|
|
FwSignedSizeType size = buffer.getBuffLength();
|
|
const U32 expectedSize = size;
|
|
const U8 *const buffAddr = buffer.getBuffAddr();
|
|
ASSERT_EQ(
|
|
file.write(buffAddr, size, Os::File::WaitType::WAIT),
|
|
Os::File::OP_OK
|
|
);
|
|
ASSERT_EQ(expectedSize, static_cast<U32>(size));
|
|
file.close();
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|