JsonObject_Indexer_Tests.cpp 830 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Arduino JSON library
  3. * Benoit Blanchon 2014 - MIT License
  4. */
  5. #include "CppUnitTest.h"
  6. #include "JsonArray.h"
  7. #include "JsonObject.h"
  8. using namespace Microsoft::VisualStudio::CppUnitTestFramework;
  9. using namespace ArduinoJson::Generator;
  10. namespace JsonGeneratorTests
  11. {
  12. TEST_CLASS(JsonObject_Indexer_Tests)
  13. {
  14. JsonObject<2> object;
  15. public:
  16. /* TEST_METHOD(Empty)
  17. {
  18. mustNotContain("key");
  19. }*/
  20. TEST_METHOD(OneString)
  21. {
  22. object["key"] = "value";
  23. mustContain("key", "value");
  24. }
  25. private:
  26. void mustContain(const char* key, const char* expected)
  27. {
  28. auto actual = (const char*) object[key];
  29. Assert::AreEqual(expected, actual);
  30. }
  31. };
  32. }