forked from bblanchon/ArduinoJson
Templatized all functions using String
or std::string
* Removed `ArduinoJson::String` * Removed `JsonVariant::defaultValue<T>()` * Removed non-template `JsonObject::get()` and `JsonArray.get()` * Fixed support for `StringSumHelper` (issue #184) * Replaced `ARDUINOJSON_USE_ARDUINO_STRING` by `ARDUINOJSON_ENABLE_STD_STRING` and `ARDUINOJSON_ENABLE_ARDUINO_STRING` (issue #378) * Added example `StringExample.ino` to show where `String` can be used
This commit is contained in:
@ -5,8 +5,8 @@
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ArduinoJson.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class DynamicJsonBuffer_Basic_Tests : public testing::Test {
|
||||
protected:
|
||||
@ -38,3 +38,16 @@ TEST_F(DynamicJsonBuffer_Basic_Tests, Alignment) {
|
||||
ASSERT_EQ(0, addr & mask);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DynamicJsonBuffer_Basic_Tests, strdup) {
|
||||
char original[] = "hello";
|
||||
char* copy = buffer.strdup(original);
|
||||
strcpy(original, "world");
|
||||
ASSERT_STREQ("hello", copy);
|
||||
}
|
||||
|
||||
TEST_F(DynamicJsonBuffer_Basic_Tests, strdup_givenNull) {
|
||||
const char* original = NULL;
|
||||
char* copy = buffer.strdup(original);
|
||||
ASSERT_EQ(NULL, copy);
|
||||
}
|
||||
|
Reference in New Issue
Block a user