From 8daa83a594a2e98f39d764422bfbdbc62c9efd44 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 19:20:00 +0200 Subject: Adding upstream version 2:4.20.0+dfsg. Signed-off-by: Daniel Baumann --- ctdb/tests/src/protocol_basic_test.c | 106 +++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 ctdb/tests/src/protocol_basic_test.c (limited to 'ctdb/tests/src/protocol_basic_test.c') diff --git a/ctdb/tests/src/protocol_basic_test.c b/ctdb/tests/src/protocol_basic_test.c new file mode 100644 index 0000000..7046718 --- /dev/null +++ b/ctdb/tests/src/protocol_basic_test.c @@ -0,0 +1,106 @@ +/* + protocol types tests + + Copyright (C) Amitay Isaacs 2015-2017 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . +*/ + +#include + +#include "protocol/protocol_basic.c" + +#include "tests/src/protocol_common_basic.h" + +PROTOCOL_TYPE1_TEST(uint8_t, ctdb_uint8); +PROTOCOL_TYPE1_TEST(uint16_t, ctdb_uint16); +PROTOCOL_TYPE1_TEST(int32_t, ctdb_int32); +PROTOCOL_TYPE1_TEST(uint32_t, ctdb_uint32); +PROTOCOL_TYPE1_TEST(uint64_t, ctdb_uint64); +PROTOCOL_TYPE1_TEST(double, ctdb_double); +PROTOCOL_TYPE1_TEST(bool, ctdb_bool); + +static void test_ctdb_chararray(void) +{ + size_t len = rand_int(1000) + 1; + char p1[len], p2[len]; + size_t buflen, np = 0; + size_t i; + int ret; + + for (i=0; i