Add emplace test

This commit is contained in:
Simon Brand
2018-07-11 14:32:25 +01:00
parent 5dd9ed7e2c
commit aa74eb709f
3 changed files with 16 additions and 0 deletions

13
tests/emplace.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "catch.hpp"
#include "optional.hpp"
#include <utility>
#include <tuple>
TEST_CASE("Emplace", "[emplace]") {
tl::optional<std::pair<std::pair<int,int>, std::pair<double, double>>> i;
i.emplace(std::piecewise_construct, std::make_tuple(0,2), std::make_tuple(3,4));
REQUIRE(i->first.first == 0);
REQUIRE(i->first.second == 2);
REQUIRE(i->second.first == 3);
REQUIRE(i->second.second == 4);
}