forked from bblanchon/ArduinoJson
Added a test of an empty hashtable
This commit is contained in:
30
JsonGeneratorTests/JsonHashTableTests.cpp
Normal file
30
JsonGeneratorTests/JsonHashTableTests.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "CppUnitTest.h"
|
||||
#include "JsonHashTable.h"
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
||||
namespace JsonGeneratorTests
|
||||
{
|
||||
TEST_CLASS(JsonHashTableTests)
|
||||
{
|
||||
JsonHashTable<2> hash;
|
||||
|
||||
public:
|
||||
|
||||
TEST_METHOD(Empty)
|
||||
{
|
||||
assertJsonIs("{}");
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void assertJsonIs(const char* expected)
|
||||
{
|
||||
char buffer[256];
|
||||
|
||||
hash.writeTo(buffer, sizeof(buffer));
|
||||
|
||||
Assert::AreEqual(expected, buffer);
|
||||
}
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user