You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
442 B

#include <ArduinoJson.h>
#include <catch.hpp>
#include <string>
#include <utility>
using namespace std;
TEST_CASE("std::swap") {
SECTION("JsonDocument*") {
JsonDocument *p1, *p2;
swap(p1, p2); // issue #1678
}
SECTION("JsonDocument") {
JsonDocument doc1, doc2;
doc1.set("hello");
doc2.set("world");
swap(doc1, doc2);
CHECK(doc1.as<string>() == "world");
CHECK(doc2.as<string>() == "hello");
}
}