Using FixedCapacityContainer for rxDbitList (#22)

* fixed capacity container

* changed shm date
This commit is contained in:
Erik Fröjdh
2019-05-15 09:16:18 +02:00
committed by Dhanya Thattil
parent bf0847e967
commit 877bdb8979
6 changed files with 60 additions and 107 deletions

View File

@ -20,6 +20,8 @@ template <typename T, size_t Capacity> class FixedCapacityContainer {
bool operator==(const std::vector<T> &other) const noexcept;
bool operator!=(const std::vector<T> &other) const noexcept;
operator std::vector<T>(){return std::vector<T>(begin(), end());}
template <size_t OtherCapacity>
bool operator==(const FixedCapacityContainer<T, OtherCapacity> &other) const
noexcept;

View File

@ -24,6 +24,7 @@
#include "ansi.h"
#define BIT32_MASK 0xFFFFFFFF
#define MAX_RX_DBIT 64
/** default ports */
#define DEFAULT_PORTNO 1952

View File

@ -215,3 +215,16 @@ SCENARIO("Assigning containers to each other", "[support]") {
}
}
SCENARIO("Converting to vector", "[support]"){
GIVEN("a FixedCapacityContainer"){
FixedCapacityContainer<int, 5> a{1,2,3};
WHEN("Converted into a vector"){
std::vector<int> b(a);
THEN("Data and size matches"){
REQUIRE(a == b);
REQUIRE(a.size() == b.size());
}
}
}
}