mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
Reorganized writer classes
This commit is contained in:
@ -9,15 +9,15 @@
|
||||
#define ARDUINOJSON_ENABLE_NAN 1
|
||||
#define ARDUINOJSON_ENABLE_INFINITY 1
|
||||
#include <ArduinoJson/Json/TextFormatter.hpp>
|
||||
#include <ArduinoJson/Serialization/DynamicStringWriter.hpp>
|
||||
#include <ArduinoJson/Serialization/Writer.hpp>
|
||||
|
||||
using namespace ARDUINOJSON_NAMESPACE;
|
||||
|
||||
template <typename TFloat>
|
||||
void check(TFloat input, const std::string& expected) {
|
||||
std::string output;
|
||||
DynamicStringWriter<std::string> sb(output);
|
||||
TextFormatter<DynamicStringWriter<std::string> > writer(sb);
|
||||
Writer<std::string> sb(output);
|
||||
TextFormatter<Writer<std::string> > writer(sb);
|
||||
writer.writeFloat(input);
|
||||
REQUIRE(writer.bytesWritten() == output.size());
|
||||
CHECK(expected == output);
|
||||
|
Reference in New Issue
Block a user