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

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

BlueMix用のフィアルを追加

File size: 1012 bytes
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 JsonArray_Remove_Tests : public ::testing::Test {
12 protected:
13 JsonArray_Remove_Tests() : _array(_jsonBuffer.createArray()) {
14 _array.add("one");
15 _array.add("two");
16 _array.add("three");
17 }
18
19 DynamicJsonBuffer _jsonBuffer;
20 JsonArray& _array;
21};
22
23#define TEST_(name) TEST_F(JsonArray_Remove_Tests, name)
24
25TEST_(RemoveFirstElement) {
26 _array.removeAt(0);
27
28 EXPECT_EQ(2, _array.size());
29 EXPECT_STREQ("two", _array[0]);
30 EXPECT_STREQ("three", _array[1]);
31}
32
33TEST_(RemoveMiddleElement) {
34 _array.removeAt(1);
35
36 EXPECT_EQ(2, _array.size());
37 EXPECT_STREQ("one", _array[0]);
38 EXPECT_STREQ("three", _array[1]);
39}
40
41TEST_(RemoveLastElement) {
42 _array.removeAt(2);
43
44 EXPECT_EQ(2, _array.size());
45 EXPECT_STREQ("one", _array[0]);
46 EXPECT_STREQ("two", _array[1]);
47}
Note: See TracBrowser for help on using the repository browser.