Renamed ARDUINO_JSON_NO_DEPRECATED_WARNING into ARDUINO_JSON_NO_DEPRECATION_WARNING

This commit is contained in:
Benoit Blanchon
2014-07-22 20:33:17 +02:00
parent 649f292ea7
commit abef85218e
8 changed files with 105 additions and 104 deletions

View File

@ -97,6 +97,6 @@ namespace ArduinoJson
}; };
// Obsolete: Use JsonObject instead // Obsolete: Use JsonObject instead
typedef JsonObject JsonHashTable; DEPRECATED typedef JsonObject JsonHashTable;
} }
} }

View File

@ -7,7 +7,7 @@
#include "JsonToken.h" #include "JsonToken.h"
#ifndef ARDUINO_JSON_NO_DEPRECATED_WARNING #ifndef ARDUINO_JSON_NO_DEPRECATION_WARNING
#ifdef __GNUC__ #ifdef __GNUC__
#define DEPRECATED __attribute__((deprecated)) #define DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER) #elif defined(_MSC_VER)

View File

@ -3,8 +3,6 @@
* Benoit Blanchon 2014 - MIT License * Benoit Blanchon 2014 - MIT License
*/ */
#define ARDUINO_JSON_NO_DEPRECATED_WARNING
#include "CppUnitTest.h" #include "CppUnitTest.h"
#include "JsonParser.h" #include "JsonParser.h"
#include <string> #include <string>

View File

@ -1,15 +1,19 @@
/*
* Arduino JSON library
* Benoit Blanchon 2014 - MIT License
*/
#include "CppUnitTest.h" #include "CppUnitTest.h"
#include "JsonParser.h" #include "JsonParser.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace ArduinoJson::Parser; using namespace ArduinoJson::Parser;
namespace JsonParserTests namespace JsonParserTests
{ {
TEST_CLASS(JsonArrayIteratorTests) TEST_CLASS(JsonArrayIteratorTests)
{ {
public: public:
TEST_METHOD(EmptyJson) TEST_METHOD(EmptyJson)
{ {
@ -28,10 +32,10 @@ namespace JsonParserTests
Assert::AreEqual(0, loopCount); Assert::AreEqual(0, loopCount);
} }
TEST_METHOD(ThreeIntegers) TEST_METHOD(ThreeIntegers)
{ {
char json [] = "[1,2,3]"; char json [] = "[1,2,3]";
long expected [] = { 1, 2, 3 }; long expected [] = {1, 2, 3};
JsonParser<4> parser; JsonParser<4> parser;
JsonArray a = parser.parse(json); JsonArray a = parser.parse(json);
@ -42,12 +46,12 @@ namespace JsonParserTests
{ {
Assert::AreEqual(expected[index++], i); Assert::AreEqual(expected[index++], i);
} }
} }
TEST_METHOD(ThreeStrings) TEST_METHOD(ThreeStrings)
{ {
char json[] = "[\"1\",\"2\",\"3\"]"; char json[] = "[\"1\",\"2\",\"3\"]";
char* expected[] = { "1", "2", "3" }; char* expected[] = {"1", "2", "3"};
JsonParser<4> parser; JsonParser<4> parser;
JsonArray a = parser.parse(json); JsonArray a = parser.parse(json);
@ -59,5 +63,5 @@ namespace JsonParserTests
Assert::AreEqual(expected[index++], i); Assert::AreEqual(expected[index++], i);
} }
} }
}; };
} }

View File

@ -3,8 +3,6 @@
* Benoit Blanchon 2014 - MIT License * Benoit Blanchon 2014 - MIT License
*/ */
#define ARDUINO_JSON_NO_DEPRECATED_WARNING
#include "CppUnitTest.h" #include "CppUnitTest.h"
#include "JsonParser.h" #include "JsonParser.h"

View File

@ -1,10 +1,14 @@
/*
* Arduino JSON library
* Benoit Blanchon 2014 - MIT License
*/
#include "CppUnitTest.h" #include "CppUnitTest.h"
#include "JsonParser.h" #include "JsonParser.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework; using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace ArduinoJson::Parser; using namespace ArduinoJson::Parser;
namespace JsonParserTests namespace JsonParserTests
{ {
TEST_CLASS(JsonObjectIteratorTests) TEST_CLASS(JsonObjectIteratorTests)
@ -48,8 +52,8 @@ namespace JsonParserTests
TEST_METHOD(ThreeStrings) TEST_METHOD(ThreeStrings)
{ {
char json[] = "{\"key1\":\"value1\",\"key2\":\"value2\",\"key3\":\"value3\"}"; char json[] = "{\"key1\":\"value1\",\"key2\":\"value2\",\"key3\":\"value3\"}";
char* expectedKeys[] = { "key1", "key2", "key3" }; char* expectedKeys[] = {"key1", "key2", "key3"};
char* expectedValues[] = { "value1", "value2", "value3" }; char* expectedValues[] = {"value1", "value2", "value3"};
JsonParser<7> parser; JsonParser<7> parser;
JsonHashTable a = parser.parse(json); JsonHashTable a = parser.parse(json);
@ -63,6 +67,5 @@ namespace JsonParserTests
index++; index++;
} }
} }
}; };
} }

View File

@ -3,8 +3,6 @@
* Benoit Blanchon 2014 - MIT License * Benoit Blanchon 2014 - MIT License
*/ */
#define ARDUINO_JSON_NO_DEPRECATED_WARNING
#include "CppUnitTest.h" #include "CppUnitTest.h"
#include "JsonParser.h" #include "JsonParser.h"
#include <string> #include <string>
@ -16,14 +14,14 @@ using namespace ArduinoJson::Parser;
namespace ArduinoJsonParserTests namespace ArduinoJsonParserTests
{ {
TEST_CLASS(JsonHashTableTests) TEST_CLASS(JsonHashTableTests)
{ {
JsonHashTable hashTable; JsonHashTable hashTable;
JsonArray nestedArray; JsonArray nestedArray;
char json[256]; char json[256];
jsmntok_t tokens[32]; jsmntok_t tokens[32];
JsonParserBase parser = JsonParserBase(tokens, 32); JsonParserBase parser = JsonParserBase(tokens, 32);
public: public:
TEST_METHOD(EmptyString) TEST_METHOD(EmptyString)
{ {
@ -150,7 +148,7 @@ namespace ArduinoJsonParserTests
Assert::IsFalse(hashTable.getArray(key).success()); Assert::IsFalse(hashTable.getArray(key).success());
Assert::IsFalse(hashTable.getBool(key)); Assert::IsFalse(hashTable.getBool(key));
Assert::AreEqual(0.0, hashTable.getDouble(key)); Assert::AreEqual(0.0, hashTable.getDouble(key));
Assert::AreEqual(0L, hashTable.getLong(key)); Assert::AreEqual(0L, hashTable.getLong(key));
Assert::IsNull(hashTable.getString(key)); Assert::IsNull(hashTable.getString(key));
} }
@ -169,5 +167,5 @@ namespace ArduinoJsonParserTests
{ {
Assert::AreEqual(expected, nestedArray.getLong(index)); Assert::AreEqual(expected, nestedArray.getLong(index));
} }
}; };
} }

View File

@ -56,7 +56,7 @@
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ARDUINO_JSON_NO_DEPRECATION_WARNING;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<UseFullPaths>true</UseFullPaths> <UseFullPaths>true</UseFullPaths>
</ClCompile> </ClCompile>
<Link> <Link>