forked from bblanchon/ArduinoJson
Test casting a JsonValue to a string
This commit is contained in:
@ -88,6 +88,7 @@
|
|||||||
<ClCompile Include="JsonArrayTests.cpp" />
|
<ClCompile Include="JsonArrayTests.cpp" />
|
||||||
<ClCompile Include="JsonObject_Indexer_Tests.cpp" />
|
<ClCompile Include="JsonObject_Indexer_Tests.cpp" />
|
||||||
<ClCompile Include="JsonObject_PrintTo_Tests.cpp" />
|
<ClCompile Include="JsonObject_PrintTo_Tests.cpp" />
|
||||||
|
<ClCompile Include="JsonValue_Cast_Tests.cpp" />
|
||||||
<ClCompile Include="JsonValue_PrintTo_Tests.cpp" />
|
<ClCompile Include="JsonValue_PrintTo_Tests.cpp" />
|
||||||
<ClCompile Include="StringBuilderTests.cpp" />
|
<ClCompile Include="StringBuilderTests.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -33,5 +33,8 @@
|
|||||||
<ClCompile Include="JsonValue_PrintTo_Tests.cpp">
|
<ClCompile Include="JsonValue_PrintTo_Tests.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="JsonValue_Cast_Tests.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
36
JsonGeneratorTests/JsonValue_Cast_Tests.cpp
Normal file
36
JsonGeneratorTests/JsonValue_Cast_Tests.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Arduino JSON library
|
||||||
|
* Benoit Blanchon 2014 - MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "CppUnitTest.h"
|
||||||
|
#include "StringBuilder.h"
|
||||||
|
#include "JsonValue.h"
|
||||||
|
|
||||||
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
|
using namespace ArduinoJson::Generator;
|
||||||
|
using namespace ArduinoJson::Internals;
|
||||||
|
|
||||||
|
namespace JsonGeneratorTests
|
||||||
|
{
|
||||||
|
TEST_CLASS(JsonValue_Cast_Tests)
|
||||||
|
{
|
||||||
|
JsonValue value;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
TEST_METHOD(String)
|
||||||
|
{
|
||||||
|
value = "hello";
|
||||||
|
mustCastTo("hello");
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void mustCastTo(const char* expected)
|
||||||
|
{
|
||||||
|
const char* actual = value;
|
||||||
|
Assert::AreEqual(expected, actual);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user