s3:libsmb: Honor disable_netbios option in smbsock_connect_send
[Samba.git] / ctdb / tests / src / reqid_test.c
blobec0c4a56df1520a59a37c5edd00b66428a469ee2
1 /*
2 reqid tests
4 Copyright (C) Amitay Isaacs 2015
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "replace.h"
22 #include <assert.h>
24 #include "common/reqid.c"
27 int main(void)
29 struct reqid_context *reqid_ctx;
30 TALLOC_CTX *mem_ctx = talloc_new(NULL);
31 int i, ret;
32 uint32_t reqid;
33 int *data, *tmp;
35 ret = reqid_init(mem_ctx, INT_MAX-200, &reqid_ctx);
36 assert(ret == 0);
38 data = talloc_zero(mem_ctx, int);
39 assert(data != 0);
41 for (i=0; i<1024*1024; i++) {
42 reqid = reqid_new(reqid_ctx, data);
43 assert(reqid != -1);
46 for (i=0; i<1024; i++) {
47 tmp = reqid_find(reqid_ctx, i, int);
48 assert(tmp == data);
51 for (i=0; i<1024; i++) {
52 ret = reqid_remove(reqid_ctx, i);
53 assert(ret == 0);
56 for (i=0; i<1024; i++) {
57 tmp = reqid_find(reqid_ctx, i, int);
58 assert(tmp == NULL);
61 for (i=0; i<1024; i++) {
62 ret = reqid_remove(reqid_ctx, i);
63 assert(ret == ENOENT);
66 talloc_free(reqid_ctx);
67 assert(talloc_get_size(mem_ctx) == 0);
69 talloc_free(mem_ctx);
71 return 0;