Quellcode durchsuchen

Generator: added a test with two numbers in an array

Benoit Blanchon vor 11 Jahren
Ursprung
Commit
bb705bab63

+ 12 - 4
JsonGeneratorTests/JsonArrayTests.cpp

@@ -16,14 +16,14 @@ namespace JsonGeneratorTests
             AssertJsonIs("[]");
         }
 
-        TEST_METHOD(OneString)
+        TEST_METHOD(AddOneString)
         {
             arr.add("hello");
 
             AssertJsonIs("['hello']");
         }
 
-        TEST_METHOD(TwoStrings)
+        TEST_METHOD(AddTwoStrings)
         {
             arr.add("hello");
             arr.add("world");
@@ -31,7 +31,7 @@ namespace JsonGeneratorTests
             AssertJsonIs("['hello','world']");
         }
 
-        TEST_METHOD(OverCapacity)
+        TEST_METHOD(AddOneStringOverCapacity)
         {
             arr.add("hello");
             arr.add("world");
@@ -40,13 +40,21 @@ namespace JsonGeneratorTests
             AssertJsonIs("['hello','world']");
         }
 
-        TEST_METHOD(OneNumber)
+        TEST_METHOD(AddOneNumber)
         {
             arr.add(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)
         {      
             char buffer[256];

+ 1 - 1
JsonGeneratorTests/JsonGeneratorTests.vcxproj

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