forked from bblanchon/ArduinoJson
Generator: added a test with two numbers in an array
This commit is contained in:
@ -16,14 +16,14 @@ namespace JsonGeneratorTests
|
|||||||
AssertJsonIs("[]");
|
AssertJsonIs("[]");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(OneString)
|
TEST_METHOD(AddOneString)
|
||||||
{
|
{
|
||||||
arr.add("hello");
|
arr.add("hello");
|
||||||
|
|
||||||
AssertJsonIs("['hello']");
|
AssertJsonIs("['hello']");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(TwoStrings)
|
TEST_METHOD(AddTwoStrings)
|
||||||
{
|
{
|
||||||
arr.add("hello");
|
arr.add("hello");
|
||||||
arr.add("world");
|
arr.add("world");
|
||||||
@ -31,7 +31,7 @@ namespace JsonGeneratorTests
|
|||||||
AssertJsonIs("['hello','world']");
|
AssertJsonIs("['hello','world']");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(OverCapacity)
|
TEST_METHOD(AddOneStringOverCapacity)
|
||||||
{
|
{
|
||||||
arr.add("hello");
|
arr.add("hello");
|
||||||
arr.add("world");
|
arr.add("world");
|
||||||
@ -40,13 +40,21 @@ namespace JsonGeneratorTests
|
|||||||
AssertJsonIs("['hello','world']");
|
AssertJsonIs("['hello','world']");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_METHOD(OneNumber)
|
TEST_METHOD(AddOneNumber)
|
||||||
{
|
{
|
||||||
arr.add(3.14);
|
arr.add(3.14);
|
||||||
|
|
||||||
AssertJsonIs("[3.14]");
|
AssertJsonIs("[3.14]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_METHOD(AddTwoNumbers)
|
||||||
|
{
|
||||||
|
arr.add(3.14);
|
||||||
|
arr.add(2.72);
|
||||||
|
|
||||||
|
AssertJsonIs("[3.14,2.72]");
|
||||||
|
}
|
||||||
|
|
||||||
void AssertJsonIs(const char* expected)
|
void AssertJsonIs(const char* expected)
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
@ -53,7 +53,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>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<UseFullPaths>true</UseFullPaths>
|
<UseFullPaths>true</UseFullPaths>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
|
Reference in New Issue
Block a user