Files
domo-iot/src/tests/test_sprinkler.c
NADAL Jean-Baptiste 0291ee9c4d
All checks were successful
continuous-integration/drone/push Build is passing
Add function test and feature to remove sprinkler
2020-01-09 10:58:37 +01:00

69 lines
2.5 KiB
C

/*!
* test_sprinkler.c
*
* Copyright (c) 2015-2020, NADAL Jean-Baptiste. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*
* @Author: NADAL Jean-Baptiste
* @Date: 07/01/2020
*
*/
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com
#define kSprinklerTestNameTrue "{ \"id\": 1, \"name\": \"test_name\", \"state\": true }"
#define kSprinklerTestNameFalse "{ \"id\": 1, \"name\": \"test_name\", \"state\": false }"
#define kSprinklerTestNameFull "[ { \"id\": 1, \"name\": \"test1\", \"state\": false }, { \"id\": 2, \"name\": \"test2\", \"state\": false }, { \"id\": 3, \"name\": \"test3\", \"state\": false } ]"
#define kSprinklerTestRemoved "[ { \"id\": 1, \"name\": \"test1\", \"state\": false }, { \"id\": 3, \"name\": \"test3\", \"state\": false } ]"
/*--------------------------------------------------------------------------*/
TEST("Sprinkler - create set_state free\t")
{
device_create_set_state_free(kSprinklerEntry, kSprinklerTestNameTrue, kSprinklerTestNameFalse);
}
/*--------------------------------------------------------------------------*/
TEST("Sprinkler - create 3 device remove 2\t")
{
device_create_three_devices_remove_second(kSprinklerEntry, kSprinklerTestNameFull, kSprinklerTestRemoved);
}
/*--------------------------------------------------------------------------*/
TEST("Sprinkler - create - Error case\t")
{
device_create_error_case(kSprinklerEntry);
}
/*--------------------------------------------------------------------------*/
TEST("Sprinkler - get_by_id - Error case\t")
{
device_get_by_id_error_case(kSprinklerEntry);
}
/*--------------------------------------------------------------------------*/
TEST("Sprinkler - update - Error case\t")
{
device_get_by_id_error_case(kSprinklerEntry);
}