source: rtos_arduino/trunk/arduino_lib/libraries/ArduinoJson/test/Issue34.cpp@ 209

Last change on this file since 209 was 209, checked in by ertl-honda, 8 years ago

BlueMix用のフィアルを追加

File size: 1.0 KB
Line 
1// Copyright Benoit Blanchon 2014-2016
2// MIT License
3//
4// Arduino JSON library
5// https://github.com/bblanchon/ArduinoJson
6// If you like this project, please add a star!
7
8#include <gtest/gtest.h>
9#include <ArduinoJson.h>
10
11class Issue34 : public testing::Test {
12 protected:
13 template <typename T>
14 void test_with_value(T expected) {
15 StaticJsonBuffer<JSON_OBJECT_SIZE(1)> jsonBuffer;
16
17 JsonObject& jsonObject = jsonBuffer.createObject();
18
19 jsonObject["key"] = expected;
20 T actual = jsonObject["key"];
21
22 ASSERT_EQ(expected, actual);
23 }
24};
25
26TEST_F(Issue34, int8_t) { test_with_value<int8_t>(1); }
27
28TEST_F(Issue34, uint8_t) { test_with_value<uint8_t>(2); }
29
30TEST_F(Issue34, int16_t) { test_with_value<int16_t>(3); }
31
32TEST_F(Issue34, uint16_t) { test_with_value<uint16_t>(4); }
33
34TEST_F(Issue34, int32_t) { test_with_value<int32_t>(5); }
35
36TEST_F(Issue34, uint32_t) { test_with_value<uint32_t>(6); }
37
38TEST_F(Issue34, float) { test_with_value<float>(7); }
39
40TEST_F(Issue34, double) { test_with_value<double>(8); }
Note: See TracBrowser for help on using the repository browser.