mirror of
https://github.com/bblanchon/ArduinoJson.git
synced 2025-07-16 12:02:14 +02:00
Test initial size() of DynamicJsonBuffer
This commit is contained in:
25
include/ArduinoJson/DynamicJsonBuffer.hpp
Normal file
25
include/ArduinoJson/DynamicJsonBuffer.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright Benoit Blanchon 2014
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "JsonBuffer.hpp"
|
||||
|
||||
namespace ArduinoJson {
|
||||
|
||||
// Implements a JsonBuffer with dynamic memory allocation.
|
||||
// You are strongly encouraged to consider using StaticJsonBuffer which is much
|
||||
// more suitable for embedded systems.
|
||||
class DynamicJsonBuffer : public JsonBuffer {
|
||||
public:
|
||||
explicit DynamicJsonBuffer() {}
|
||||
|
||||
size_t size() const { return 0; }
|
||||
|
||||
protected:
|
||||
virtual void* alloc(size_t bytes) { return NULL; }
|
||||
};
|
||||
}
|
21
test/DynamicJsonBuffer_Basic_Tests.cpp
Normal file
21
test/DynamicJsonBuffer_Basic_Tests.cpp
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright Benoit Blanchon 2014
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#define protected public
|
||||
#include <ArduinoJson/DynamicJsonBuffer.hpp>
|
||||
|
||||
using namespace ArduinoJson;
|
||||
|
||||
class DynamicJsonBuffer_Basic_Tests : public testing::Test {
|
||||
protected:
|
||||
DynamicJsonBuffer buffer;
|
||||
};
|
||||
|
||||
TEST_F(DynamicJsonBuffer_Basic_Tests, InitialSizeIsZero) {
|
||||
ASSERT_EQ(0, buffer.size());
|
||||
}
|
Reference in New Issue
Block a user