Add test for std::array converter
This commit is contained in:
parent
e592f83e65
commit
90281cfdc3
@ -12,6 +12,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "yaml-cpp/binary.h"
|
#include "yaml-cpp/binary.h"
|
||||||
#include "yaml-cpp/node/impl.h"
|
#include "yaml-cpp/node/impl.h"
|
||||||
|
|||||||
@ -154,6 +154,20 @@ TEST(NodeTest, SimpleSubkeys) {
|
|||||||
EXPECT_EQ("monkey", node["username"].as<std::string>());
|
EXPECT_EQ("monkey", node["username"].as<std::string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(NodeTest, StdArray) {
|
||||||
|
std::array<int, 5> evens;
|
||||||
|
evens[0] = 2;
|
||||||
|
evens[1] = 4;
|
||||||
|
evens[2] = 6;
|
||||||
|
evens[3] = 8;
|
||||||
|
evens[4] = 10;
|
||||||
|
|
||||||
|
Node node;
|
||||||
|
node["evens"] = evens;
|
||||||
|
std::array<int, 5> actualEvens = node["evens"].as<std::array<int, 5> >();
|
||||||
|
EXPECT_EQ(evens, actualEvens);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(NodeTest, StdVector) {
|
TEST(NodeTest, StdVector) {
|
||||||
std::vector<int> primes;
|
std::vector<int> primes;
|
||||||
primes.push_back(2);
|
primes.push_back(2);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user