// Copyright Benoit Blanchon 2014-2016 // MIT License // // Arduino JSON library // https://github.com/bblanchon/ArduinoJson // If you like this project, please add a star! #include #include class Issue34 : public testing::Test { protected: template void test_with_value(T expected) { StaticJsonBuffer jsonBuffer; JsonObject& jsonObject = jsonBuffer.createObject(); jsonObject["key"] = expected; T actual = jsonObject["key"]; ASSERT_EQ(expected, actual); } }; TEST_F(Issue34, int8_t) { test_with_value(1); } TEST_F(Issue34, uint8_t) { test_with_value(2); } TEST_F(Issue34, int16_t) { test_with_value(3); } TEST_F(Issue34, uint16_t) { test_with_value(4); } TEST_F(Issue34, int32_t) { test_with_value(5); } TEST_F(Issue34, uint32_t) { test_with_value(6); } TEST_F(Issue34, float) { test_with_value(7); } TEST_F(Issue34, double) { test_with_value(8); }