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

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

BlueMix用のフィアルを追加

File size: 1.1 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 NoMemoryAllocator {
12 public:
13 void* allocate(size_t) { return NULL; }
14 void deallocate(void*) {}
15};
16
17class DynamicJsonBuffer_NoMemory_Tests : public ::testing::Test {
18 protected:
19 Internals::BlockJsonBuffer<NoMemoryAllocator> _jsonBuffer;
20};
21
22TEST_F(DynamicJsonBuffer_NoMemory_Tests, FixCodeCoverage) {
23 // call this function to fix code coverage
24 NoMemoryAllocator().deallocate(NULL);
25}
26
27TEST_F(DynamicJsonBuffer_NoMemory_Tests, CreateArray) {
28 ASSERT_FALSE(_jsonBuffer.createArray().success());
29}
30
31TEST_F(DynamicJsonBuffer_NoMemory_Tests, CreateObject) {
32 ASSERT_FALSE(_jsonBuffer.createObject().success());
33}
34
35TEST_F(DynamicJsonBuffer_NoMemory_Tests, ParseArray) {
36 char json[] = "[]";
37 ASSERT_FALSE(_jsonBuffer.parseArray(json).success());
38}
39
40TEST_F(DynamicJsonBuffer_NoMemory_Tests, ParseObject) {
41 char json[] = "{}";
42 ASSERT_FALSE(_jsonBuffer.parseObject(json).success());
43}
Note: See TracBrowser for help on using the repository browser.