forked from bblanchon/ArduinoJson
Updated copyright year from 2016 to 2017
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# Copyright Benoit Blanchon 2014-2016
|
||||
# Copyright Benoit Blanchon 2014-2017
|
||||
# MIT License
|
||||
#
|
||||
# Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
TEST(DynamicJsonBuffer_Array_Tests, GrowsWithArray) {
|
||||
DynamicJsonBuffer jsonBuffer;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
TEST(DynamicJsonBuffer_Object_Tests, GrowsWithObject) {
|
||||
DynamicJsonBuffer json;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 GbathreeBug : public testing::Test {
|
||||
public:
|
||||
@ -34,37 +34,61 @@ class GbathreeBug : public testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(GbathreeBug, Success) { EXPECT_TRUE(_object.success()); }
|
||||
TEST_F(GbathreeBug, Success) {
|
||||
EXPECT_TRUE(_object.success());
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, ProtocolName) {
|
||||
EXPECT_STREQ("fluorescence", _object["protocol_name"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Repeats) { EXPECT_EQ(1, _object["repeats"]); }
|
||||
TEST_F(GbathreeBug, Repeats) {
|
||||
EXPECT_EQ(1, _object["repeats"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Wait) { EXPECT_EQ(0, _object["wait"]); }
|
||||
TEST_F(GbathreeBug, Wait) {
|
||||
EXPECT_EQ(0, _object["wait"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Measurements) { EXPECT_EQ(3, _object["measurements"]); }
|
||||
TEST_F(GbathreeBug, Measurements) {
|
||||
EXPECT_EQ(3, _object["measurements"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Meas2_Light) { EXPECT_EQ(15, _object["meas2_light"]); }
|
||||
TEST_F(GbathreeBug, Meas2_Light) {
|
||||
EXPECT_EQ(15, _object["meas2_light"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Meas1_Baseline) { EXPECT_EQ(0, _object["meas1_baseline"]); }
|
||||
TEST_F(GbathreeBug, Meas1_Baseline) {
|
||||
EXPECT_EQ(0, _object["meas1_baseline"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Act_Light) { EXPECT_EQ(20, _object["act_light"]); }
|
||||
TEST_F(GbathreeBug, Act_Light) {
|
||||
EXPECT_EQ(20, _object["act_light"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Pulsesize) { EXPECT_EQ(25, _object["pulsesize"]); }
|
||||
TEST_F(GbathreeBug, Pulsesize) {
|
||||
EXPECT_EQ(25, _object["pulsesize"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Pulsedistance) {
|
||||
EXPECT_EQ(10000, _object["pulsedistance"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Actintensity1) { EXPECT_EQ(50, _object["actintensity1"]); }
|
||||
TEST_F(GbathreeBug, Actintensity1) {
|
||||
EXPECT_EQ(50, _object["actintensity1"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Actintensity2) { EXPECT_EQ(255, _object["actintensity2"]); }
|
||||
TEST_F(GbathreeBug, Actintensity2) {
|
||||
EXPECT_EQ(255, _object["actintensity2"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Measintensity) { EXPECT_EQ(255, _object["measintensity"]); }
|
||||
TEST_F(GbathreeBug, Measintensity) {
|
||||
EXPECT_EQ(255, _object["measintensity"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Calintensity) { EXPECT_EQ(255, _object["calintensity"]); }
|
||||
TEST_F(GbathreeBug, Calintensity) {
|
||||
EXPECT_EQ(255, _object["calintensity"]);
|
||||
}
|
||||
|
||||
TEST_F(GbathreeBug, Pulses) {
|
||||
// "pulses":[50,50,50]
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 IntegrationTests : public testing::TestWithParam<const char*> {
|
||||
static const size_t MAX_JSON_SIZE = 10000;
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
struct Person {
|
||||
int id;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 Issue34 : public testing::Test {
|
||||
protected:
|
||||
@ -23,18 +23,34 @@ class Issue34 : public testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(Issue34, int8_t) { test_with_value<int8_t>(1); }
|
||||
TEST_F(Issue34, int8_t) {
|
||||
test_with_value<int8_t>(1);
|
||||
}
|
||||
|
||||
TEST_F(Issue34, uint8_t) { test_with_value<uint8_t>(2); }
|
||||
TEST_F(Issue34, uint8_t) {
|
||||
test_with_value<uint8_t>(2);
|
||||
}
|
||||
|
||||
TEST_F(Issue34, int16_t) { test_with_value<int16_t>(3); }
|
||||
TEST_F(Issue34, int16_t) {
|
||||
test_with_value<int16_t>(3);
|
||||
}
|
||||
|
||||
TEST_F(Issue34, uint16_t) { test_with_value<uint16_t>(4); }
|
||||
TEST_F(Issue34, uint16_t) {
|
||||
test_with_value<uint16_t>(4);
|
||||
}
|
||||
|
||||
TEST_F(Issue34, int32_t) { test_with_value<int32_t>(5); }
|
||||
TEST_F(Issue34, int32_t) {
|
||||
test_with_value<int32_t>(5);
|
||||
}
|
||||
|
||||
TEST_F(Issue34, uint32_t) { test_with_value<uint32_t>(6); }
|
||||
TEST_F(Issue34, uint32_t) {
|
||||
test_with_value<uint32_t>(6);
|
||||
}
|
||||
|
||||
TEST_F(Issue34, float) { test_with_value<float>(7); }
|
||||
TEST_F(Issue34, float) {
|
||||
test_with_value<float>(7);
|
||||
}
|
||||
|
||||
TEST_F(Issue34, double) { test_with_value<double>(8); }
|
||||
TEST_F(Issue34, double) {
|
||||
test_with_value<double>(8);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
@ -20,10 +20,18 @@ static const char* superLong =
|
||||
|
||||
static const JsonVariant variant = RawJson(superLong);
|
||||
|
||||
TEST(SUITE, IsNotALong) { ASSERT_FALSE(variant.is<long>()); }
|
||||
TEST(SUITE, IsNotALong) {
|
||||
ASSERT_FALSE(variant.is<long>());
|
||||
}
|
||||
|
||||
TEST(SUITE, AsLong) { ASSERT_EQ(LONG_MAX, variant.as<long>()); }
|
||||
TEST(SUITE, AsLong) {
|
||||
ASSERT_EQ(LONG_MAX, variant.as<long>());
|
||||
}
|
||||
|
||||
TEST(SUITE, IsAString) { ASSERT_FALSE(variant.is<const char*>()); }
|
||||
TEST(SUITE, IsAString) {
|
||||
ASSERT_FALSE(variant.is<const char*>());
|
||||
}
|
||||
|
||||
TEST(SUITE, AsString) { ASSERT_STREQ(superLong, variant.as<const char*>()); }
|
||||
TEST(SUITE, AsString) {
|
||||
ASSERT_STREQ(superLong, variant.as<const char*>());
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 JsonArray_Add_Tests : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
#define TEST_(name) TEST(JsonArray_Basic_Tests, name)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
TEST(JsonArray_Invalid_Tests, SubscriptFails) {
|
||||
ASSERT_FALSE(JsonArray::invalid()[0].success());
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
template <typename TIterator>
|
||||
static void run_iterator_test() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 JsonArray_Remove_Tests : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -1,16 +1,18 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 JsonArray_Set_Tests : public ::testing::Test {
|
||||
protected:
|
||||
JsonArray_Set_Tests() : _array(_jsonBuffer.createArray()) { _array.add(0); }
|
||||
JsonArray_Set_Tests() : _array(_jsonBuffer.createArray()) {
|
||||
_array.add(0);
|
||||
}
|
||||
|
||||
DynamicJsonBuffer _jsonBuffer;
|
||||
JsonArray& _array;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
#define TEST_(name) TEST(JsonObject_Basic_Tests, name)
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
#define TEST_(name) TEST(JsonObject_Basic_Tests, name)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 JsonObject_Iterator_Test : public testing::Test {
|
||||
public:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
#define TEST_(name) TEST(JsonObject_Remove_Tests, name)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
TEST(JsonParser_Nested_Tests, ArrayNestedInObject) {
|
||||
DynamicJsonBuffer jsonBuffer;
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 JsonParser_NestingLimit_Tests : public testing::Test {
|
||||
protected:
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 JsonParser_Object_Test : public testing::Test {
|
||||
protected:
|
||||
@ -15,11 +15,17 @@ class JsonParser_Object_Test : public testing::Test {
|
||||
_object = &_jsonBuffer.parseObject(_jsonString);
|
||||
}
|
||||
|
||||
void parseMustSucceed() { EXPECT_TRUE(_object->success()); }
|
||||
void parseMustSucceed() {
|
||||
EXPECT_TRUE(_object->success());
|
||||
}
|
||||
|
||||
void parseMustFail() { EXPECT_FALSE(_object->success()); }
|
||||
void parseMustFail() {
|
||||
EXPECT_FALSE(_object->success());
|
||||
}
|
||||
|
||||
void sizeMustBe(int expected) { EXPECT_EQ(expected, _object->size()); }
|
||||
void sizeMustBe(int expected) {
|
||||
EXPECT_EQ(expected, _object->size());
|
||||
}
|
||||
|
||||
void keyMustHaveValue(const char *key, const char *expected) {
|
||||
EXPECT_STREQ(expected, (*_object)[key]);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 JsonVariant_Copy_Tests : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
#include <limits>
|
||||
|
||||
class JsonVariant_PrintTo_Tests : public testing::Test {
|
||||
@ -21,7 +21,9 @@ class JsonVariant_PrintTo_Tests : public testing::Test {
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(JsonVariant_PrintTo_Tests, Empty) { outputMustBe(""); }
|
||||
TEST_F(JsonVariant_PrintTo_Tests, Empty) {
|
||||
outputMustBe("");
|
||||
}
|
||||
|
||||
TEST_F(JsonVariant_PrintTo_Tests, Null) {
|
||||
variant = static_cast<char *>(0);
|
||||
|
@ -1,14 +1,14 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// https://github.com/bblanchon/ArduinoJson
|
||||
// If you like this project, please add a star!
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <stdint.h>
|
||||
#include <limits>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
class JsonVariant_Storage_Tests : public ::testing::Test {
|
||||
protected:
|
||||
@ -43,36 +43,84 @@ TEST_F(JsonVariant_Storage_Tests, SizeOfJsonInteger) {
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(JsonVariant_Storage_Tests, Null) { testValue<const char *>(NULL); }
|
||||
TEST_F(JsonVariant_Storage_Tests, String) { testValue<const char *>("hello"); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Null) {
|
||||
testValue<const char *>(NULL);
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, String) {
|
||||
testValue<const char *>("hello");
|
||||
}
|
||||
|
||||
TEST_F(JsonVariant_Storage_Tests, False) { testValue<bool>(false); }
|
||||
TEST_F(JsonVariant_Storage_Tests, True) { testValue<bool>(true); }
|
||||
TEST_F(JsonVariant_Storage_Tests, False) {
|
||||
testValue<bool>(false);
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, True) {
|
||||
testValue<bool>(true);
|
||||
}
|
||||
|
||||
TEST_F(JsonVariant_Storage_Tests, Double) { testNumericType<double>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Float) { testNumericType<float>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, SChar) { testNumericType<signed char>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, SInt) { testNumericType<signed int>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, SLong) { testNumericType<signed long>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, SShort) { testNumericType<signed short>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, UChar) { testNumericType<unsigned char>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, UInt) { testNumericType<unsigned int>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, ULong) { testNumericType<unsigned long>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, UShort) { testNumericType<unsigned short>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Double) {
|
||||
testNumericType<double>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, Float) {
|
||||
testNumericType<float>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, SChar) {
|
||||
testNumericType<signed char>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, SInt) {
|
||||
testNumericType<signed int>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, SLong) {
|
||||
testNumericType<signed long>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, SShort) {
|
||||
testNumericType<signed short>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, UChar) {
|
||||
testNumericType<unsigned char>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, UInt) {
|
||||
testNumericType<unsigned int>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, ULong) {
|
||||
testNumericType<unsigned long>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, UShort) {
|
||||
testNumericType<unsigned short>();
|
||||
}
|
||||
#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64
|
||||
TEST_F(JsonVariant_Storage_Tests, LongLong) { testNumericType<unsigned long long>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, ULongLong) { testNumericType<unsigned long long>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, LongLong) {
|
||||
testNumericType<unsigned long long>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, ULongLong) {
|
||||
testNumericType<unsigned long long>();
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(JsonVariant_Storage_Tests, Int8) { testNumericType<int8_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint8) { testNumericType<uint8_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int16) { testNumericType<int16_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint16) { testNumericType<uint16_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int32) { testNumericType<int32_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint32) { testNumericType<uint32_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int8) {
|
||||
testNumericType<int8_t>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint8) {
|
||||
testNumericType<uint8_t>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, Int16) {
|
||||
testNumericType<int16_t>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint16) {
|
||||
testNumericType<uint16_t>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, Int32) {
|
||||
testNumericType<int32_t>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint32) {
|
||||
testNumericType<uint32_t>();
|
||||
}
|
||||
#if ARDUINOJSON_USE_LONG_LONG || ARDUINOJSON_USE_INT64
|
||||
TEST_F(JsonVariant_Storage_Tests, Int64) { testNumericType<int64_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint64) { testNumericType<uint64_t>(); }
|
||||
TEST_F(JsonVariant_Storage_Tests, Int64) {
|
||||
testNumericType<int64_t>();
|
||||
}
|
||||
TEST_F(JsonVariant_Storage_Tests, Uint64) {
|
||||
testNumericType<uint64_t>();
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_F(JsonVariant_Storage_Tests, CanStoreObject) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 JsonVariant_Undefined_Tests : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 StaticJsonBuffer_Basic_Tests : public testing::Test {
|
||||
protected:
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
TEST(StaticJsonBuffer_CreateArray_Tests, GrowsWithArray) {
|
||||
StaticJsonBuffer<JSON_ARRAY_SIZE(2)> json;
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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>
|
||||
|
||||
TEST(StaticJsonBuffer_CreateObject_Tests, GrowsWithObject) {
|
||||
StaticJsonBuffer<JSON_OBJECT_SIZE(3)> buffer;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,12 +1,12 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
// 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 StaticJsonBuffer_ParseObject_Tests : public testing::Test {
|
||||
protected:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
@ -16,13 +16,21 @@ class StringBuilderTests : public testing::Test {
|
||||
_stringBuilder = new StaticStringBuilder(_buffer, sizeof(_buffer));
|
||||
}
|
||||
|
||||
virtual void TearDown() { delete _stringBuilder; }
|
||||
virtual void TearDown() {
|
||||
delete _stringBuilder;
|
||||
}
|
||||
|
||||
void print(const char *value) { _returnValue = _stringBuilder->print(value); }
|
||||
void print(const char *value) {
|
||||
_returnValue = _stringBuilder->print(value);
|
||||
}
|
||||
|
||||
void outputMustBe(const char *expected) { EXPECT_STREQ(expected, _buffer); }
|
||||
void outputMustBe(const char *expected) {
|
||||
EXPECT_STREQ(expected, _buffer);
|
||||
}
|
||||
|
||||
void resultMustBe(size_t expected) { EXPECT_EQ(expected, _returnValue); }
|
||||
void resultMustBe(size_t expected) {
|
||||
EXPECT_EQ(expected, _returnValue);
|
||||
}
|
||||
|
||||
private:
|
||||
char _buffer[20];
|
||||
@ -30,7 +38,9 @@ class StringBuilderTests : public testing::Test {
|
||||
size_t _returnValue;
|
||||
};
|
||||
|
||||
TEST_F(StringBuilderTests, InitialState) { outputMustBe(""); }
|
||||
TEST_F(StringBuilderTests, InitialState) {
|
||||
outputMustBe("");
|
||||
}
|
||||
|
||||
TEST_F(StringBuilderTests, OverCapacity) {
|
||||
print("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright Benoit Blanchon 2014-2016
|
||||
// Copyright Benoit Blanchon 2014-2017
|
||||
// MIT License
|
||||
//
|
||||
// Arduino JSON library
|
||||
|
Reference in New Issue
Block a user