mirror of
https://github.com/nasa/fprime.git
synced 2026-04-12 05:19:03 -05:00
* Add enum tests for FPP autocoder * Filter ai_xml sources against generated sources * Revise enum tests for FPP autocoder * Add test utils for FPP autocoder * Add array tests for FPP autocoder * Refactor FppTest * Add .gitignore * Revise enum tests for FPP autocoder * Revise array tests for FPP autocoder * Add string tests for FPP autocoder * Small changes to FPP autocoder tests * Add struct tests for FPP autocoder * Revise enum tests for FPP autocoder * Update ActiveLogger and Health components for new enum deserialize() behavior * Make string test suite type-parametrized * Update READMEs for FppTest * Register FppTest as a deployment and add README * Remove quotes from GENERATED_SOURCES * Begin transition to type-parametrized tests * Transition to type-parametrized tests * Small changes to FPP autocoder tests * Small fix to FPP autocoder tests * Update fprime-fpp version * Update expected words for spell checker * Small fix * Update fprime-fpp version * Add file headers * Update expected words for spell checker * Update fprime-fpp version * Update fprime-fpp version
61 lines
1.5 KiB
C++
61 lines
1.5 KiB
C++
// ======================================================================
|
|
// \title ArrayToStringTest.cpp
|
|
// \author T. Chieu
|
|
// \brief cpp file for ArrayToStringTest class
|
|
//
|
|
// \copyright
|
|
// Copyright (C) 2009-2022 California Institute of Technology.
|
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
|
// acknowledged.
|
|
//
|
|
// ======================================================================
|
|
|
|
#include "FppTest/array/EnumArrayAc.hpp"
|
|
#include "FppTest/array/StringArrayAc.hpp"
|
|
#include "FppTest/array/StructArrayAc.hpp"
|
|
#include "FppTest/array/Uint32ArrayArrayAc.hpp"
|
|
|
|
#include "FppTest/typed_tests/ArrayTest.hpp"
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include <sstream>
|
|
|
|
// Test array string functions
|
|
template <typename ArrayType>
|
|
class ArrayToStringTest : public ::testing::Test {
|
|
protected:
|
|
void SetUp() override {
|
|
FppTest::Array::setTestVals<ArrayType>(testVals);
|
|
}
|
|
|
|
typename ArrayType::ElementType testVals[ArrayType::SIZE];
|
|
};
|
|
|
|
using ArrayTypes = ::testing::Types<
|
|
Enum,
|
|
String,
|
|
Struct,
|
|
Uint32Array
|
|
>;
|
|
TYPED_TEST_SUITE(ArrayToStringTest, ArrayTypes);
|
|
|
|
// Test array toString() and ostream operator functions
|
|
TYPED_TEST(ArrayToStringTest, ToString) {
|
|
TypeParam a(this->testVals);
|
|
std::stringstream buf1, buf2;
|
|
|
|
buf1 << a;
|
|
|
|
buf2 << "[ ";
|
|
for (U32 i = 0; i < TypeParam::SIZE; i++) {
|
|
buf2 << this->testVals[i] << " ";
|
|
}
|
|
buf2 << "]";
|
|
|
|
ASSERT_STREQ(
|
|
buf1.str().c_str(),
|
|
buf2.str().c_str()
|
|
);
|
|
}
|