JsonArrayIteratorTests.cpp 609 B

12345678910111213141516171819202122232425262728293031
  1. #include "CppUnitTest.h"
  2. #include "JsonParser.h"
  3. using namespace Microsoft::VisualStudio::CppUnitTestFramework;
  4. using namespace ArduinoJson::Parser;
  5. namespace JsonParserTests
  6. {
  7. TEST_CLASS(JsonArrayIteratorTests)
  8. {
  9. public:
  10. TEST_METHOD(ThreeIntegers)
  11. {
  12. char json [] = "[1,2,3]";
  13. long expected [] = { 1, 2, 3 };
  14. JsonParser<4> parser;
  15. JsonArray a = parser.parse(json);
  16. int index = 0;
  17. for (long i : a)
  18. {
  19. Assert::AreEqual(expected[index++], i);
  20. }
  21. }
  22. };
  23. }