s4:kdc/db-glue: allow principals in form of computer@EXAMPLE.COM
[Samba.git] / source3 / torture / t_strappend.c
blobd52371e998f9719c5dcba069ccced34c68218f67
1 /*
2 * Copyright (C) 2005 by Volker Lendecke
4 * Test harness for sprintf_append
5 */
7 #include "includes.h"
8 #include "torture/proto.h"
10 bool run_local_sprintf_append(int dummy)
12 TALLOC_CTX *mem_ctx;
13 char *string = NULL;
14 ssize_t len = 0;
15 size_t bufsize = 4;
16 int i;
18 mem_ctx = talloc_init("t_strappend");
19 if (mem_ctx == NULL) {
20 fprintf(stderr, "talloc_init failed\n");
21 return false;
24 sprintf_append(mem_ctx, &string, &len, &bufsize, "");
25 assert(strlen(string) == len);
26 sprintf_append(mem_ctx, &string, &len, &bufsize, "");
27 assert(strlen(string) == len);
28 sprintf_append(mem_ctx, &string, &len, &bufsize,
29 "01234567890123456789012345678901234567890123456789\n");
30 assert(strlen(string) == len);
33 for (i=0; i<(10000); i++) {
34 if (i%1000 == 0) {
35 printf("%d %lld\r", i, (long long int)bufsize);
36 fflush(stdout);
38 sprintf_append(mem_ctx, &string, &len, &bufsize, "%d\n", i);
39 if (strlen(string) != len) {
40 fprintf(stderr, "sprintf_append failed: strlen(string) %lld != len %lld\n",
41 (long long int)strlen(string), (long long int)len);
42 return false;
46 talloc_destroy(mem_ctx);
48 return true;