13#include "FppTest/enum/ImplicitEnumAc.hpp"
14#include "FppTest/enum/ExplicitEnumAc.hpp"
15#include "FppTest/enum/DefaultEnumAc.hpp"
16#include "FppTest/enum/IntervalEnumAc.hpp"
17#include "FppTest/enum/SerializeTypeU8EnumAc.hpp"
18#include "FppTest/enum/SerializeTypeU64EnumAc.hpp"
20#include "gtest/gtest.h"
28 template <
typename EnumType>
30 for (U32 i = 0; i < EnumType::NUM_CONSTANTS + 1; i++) {
31 a[i] =
static_cast<typename EnumType::T
>(i);
40 a[3] =
static_cast<Explicit::T
>(11);
52 a[7] =
static_cast<Interval::T
>(11);
56 template <
typename EnumType>
63 a[5] =
"[invalid] (5)";
68 a[0] =
"A (-1952875139)";
70 a[2] =
"C (2000999333)";
71 a[3] =
"[invalid] (11)";
83 a[7] =
"[invalid] (11)";
89template <
typename EnumType>
93 FppTest::setEnumValArray<EnumType>(
vals);
94 FppTest::setEnumStrArray<EnumType>(
strs);
98 std::stringstream
buf;
100 typename EnumType::T
vals[EnumType::NUM_CONSTANTS+1];
101 std::string
strs[EnumType::NUM_CONSTANTS+1];
117 for (U32 i = 0; i < TypeParam::NUM_CONSTANTS + 1; i++) {
118 this->e = this->vals[i];
119 this->buf << this->e;
121 ASSERT_STREQ(this->buf.str().c_str(), this->strs[i].c_str());
TYPED_TEST(EnumToStringTest, ToString)
TYPED_TEST_SUITE(EnumToStringTest, EnumTypes)
::testing::Types< Implicit, Explicit, Default, Interval, SerializeTypeU8, SerializeTypeU64 > EnumTypes
EnumType::T vals[EnumType::NUM_CONSTANTS+1]
std::string strs[EnumType::NUM_CONSTANTS+1]
void setEnumStrArray(std::string(&a)[EnumType::NUM_CONSTANTS+1])
void setEnumStrArray< Explicit >(std::string(&a)[Explicit::NUM_CONSTANTS+1])
void setEnumValArray< Interval >(Interval::T(&a)[Interval::NUM_CONSTANTS+1])
void setEnumValArray(typename EnumType::T(&a)[EnumType::NUM_CONSTANTS+1])
void setEnumStrArray< Interval >(std::string(&a)[Interval::NUM_CONSTANTS+1])
void setEnumValArray< Explicit >(Explicit::T(&a)[Explicit::NUM_CONSTANTS+1])