testqset_r.c
Go to the documentation of this file.
1 /*<html><pre> -<a href="../libqhull/index.htm#TOC"
2  >-------------------------------</a><a name="TOP">-</a>
3 
4  testset.c -- test qset.c and its use of mem.c
5 
6  The test sets are pointers to int. Normally a set is a pointer to a type (e.g., facetT, ridgeT, etc.).
7  For consistency in notation, an "int" is typedef'd to i2T
8 
9 Functions and macros from qset.h. Counts occurrences in this test. Does not correspond to thoroughness.
10  qh_setaddsorted -- 4 tests
11  qh_setaddnth -- 1 test
12  qh_setappend -- 7 tests
13  qh_setappend_set -- 1 test
14  qh_setappend2ndlast -- 1 test
15  qh_setcheck -- lots of tests
16  qh_setcompact -- 7 tests
17  qh_setcopy -- 3 tests
18  qh_setdel -- 1 tests
19  qh_setdellast -- 1 tests
20  qh_setdelnth -- 2 tests
21  qh_setdelnthsorted -- 2 tests
22  qh_setdelsorted -- 1 test
23  qh_setduplicate -- not testable here
24  qh_setequal -- 4 tests
25  qh_setequal_except -- 2 tests
26  qh_setequal_skip -- 2 tests
27  qh_setfree -- 11+ tests
28  qh_setfree2 -- not testable here
29  qh_setfreelong -- 2 tests
30  qh_setin -- 3 tests
31  qh_setindex -- 4 tests
32  qh_setlarger -- 1 test
33  qh_setlast -- 2 tests
34  qh_setnew -- 6 tests
35  qh_setnew_delnthsorted
36  qh_setprint -- tested elsewhere
37  qh_setreplace -- 1 test
38  qh_setsize -- 9+ tests
39  qh_settemp -- 2 tests
40  qh_settempfree -- 1 test
41  qh_settempfree_all -- 1 test
42  qh_settemppop -- 1 test
43  qh_settemppush -- 1 test
44  qh_settruncate -- 3 tests
45  qh_setunique -- 3 tests
46  qh_setzero -- 1 test
47  FOREACHint_ -- 2 test
48  FOREACHint4_
49  FOREACHint_i_ -- 1 test
50  FOREACHintreverse_
51  FOREACHintreverse12_
52  FOREACHsetelement_ -- 1 test
53  FOREACHsetelement_i_ -- 1 test
54  FOREACHsetelementreverse_ -- 1 test
55  FOREACHsetelementreverse12_ -- 1 test
56  SETelem_ -- 3 tests
57  SETelemaddr_ -- 2 tests
58  SETelemt_ -- not tested (generic)
59  SETempty_ -- 1 test
60  SETfirst_ -- 4 tests
61  SETfirstt_ -- 2 tests
62  SETindex_ -- 2 tests
63  SETref_ -- 2 tests
64  SETreturnsize_ -- 2 tests
65  SETsecond_ -- 1 test
66  SETsecondt_ -- 2 tests
67  SETtruncate_ -- 2 tests
68 
69  Copyright (c) 2012-2015 C.B. Barber. All rights reserved.
70  $Id: //main/2015/qhull/src/testqset_r/testqset_r.c#5 $$Change: 2064 $
71  $DateTime: 2016/01/18 12:36:08 $$Author: bbarber $
72 */
73 
74 #include "libqhull_r/user_r.h" /* QHULL_CRTDBG */
75 #include "libqhull_r/qset_r.h"
76 #include "libqhull_r/mem_r.h"
77 #include "libqhull_r/libqhull_r.h"
78 
79 #include <stdarg.h>
80 #include <stdio.h>
81 #include <stdlib.h>
82 #include <string.h>
83 
84 typedef int i2T;
85 #define MAXerrorCount 100 /* quit after n errors */
86 
87 #define FOREACHint_( ints ) FOREACHsetelement_( i2T, ints, i2)
88 #define FOREACHint4_( ints ) FOREACHsetelement_( i2T, ints, i4)
89 #define FOREACHint_i_( qh, ints ) FOREACHsetelement_i_( qh, i2T, ints, i2)
90 #define FOREACHintreverse_( qh, ints ) FOREACHsetelementreverse_( qh, i2T, ints, i2)
91 #define FOREACHintreverse12_( ints ) FOREACHsetelementreverse12_( i2T, ints, i2)
92 
93 enum {
94  MAXint= 0x7fffffff,
95 };
96 
97 char prompt[]= "testqset_r N [M] [T5] -- Test reentrant qset_r.c and mem_r.c\n\
98  \n\
99  If this test fails then reentrant Qhull will not work.\n\
100  \n\
101  Test qsets of 0..N integers with a check every M iterations (default ~log10)\n\
102  Additional checking and logging if M is 1\n\
103  \n\
104  T5 turns on memory logging (qset does not log)\n\
105  \n\
106  For example:\n\
107  testqset_r 10000\n\
108 ";
109 
110 int error_count= 0; /* Global error_count. checkSetContents(qh) keeps its own error count. It exits on too many errors */
111 
112 /* Macros normally defined in geom.h */
113 #define fmax_( a,b ) ( ( a ) < ( b ) ? ( b ) : ( a ) )
114 
115 /* Macros normally defined in QhullSet.h */
116 
117 /* Functions normally defined in user_r.h for usermem_r.c */
118 
119 void qh_exit(int exitcode);
120 void qh_fprintf_stderr(int msgcode, const char *fmt, ... );
121 void qh_free(void *mem);
122 void *qh_malloc(size_t size);
123 
124 /* Normally defined in user_r.c */
125 
126 void qh_errexit(qhT *qh, int exitcode, facetT *f, ridgeT *r)
127 {
128  (void)f; /* unused */
129  (void)r; /* unused */
130  (void)qh; /* unused */
131  qh_exit(exitcode);
132 }
133 
134 /* Normally defined in userprintf.c */
135 
136 void qh_fprintf(qhT *qh, FILE *fp, int msgcode, const char *fmt, ... )
137 {
138  static int needs_cr= 0; /* True if qh_fprintf needs a CR. testqset_r is not itself reentrant */
139 
140  size_t fmtlen= strlen(fmt);
141  va_list args;
142 
143  if (!fp) {
144  /* Do not use qh_fprintf_stderr. This is a standalone program */
145  if(!qh)
146  fprintf(stderr, "QH6241 qh_fprintf: fp and qh not defined for '%s'", fmt);
147  else
148  fprintf(stderr, "QH6232 qh_fprintf: fp is 0. Was wrong qh_fprintf called for '%s'", fmt);
149  qh_errexit(qh, 6232, NULL, NULL);
150  }
151  if(fmtlen>0){
152  if(fmt[fmtlen-1]=='\n'){
153  if(needs_cr && fmtlen>1){
154  fprintf(fp, "\n");
155  }
156  needs_cr= 0;
157  }else{
158  needs_cr= 1;
159  }
160  }
161  if(msgcode>=6000 && msgcode<7000){
162  fprintf(fp, "Error TQ%d ", msgcode);
163  }
164  va_start(args, fmt);
165  vfprintf(fp, fmt, args);
166  va_end(args);
167 }
168 
169 /* Defined below in order of use */
170 int main(int argc, char **argv);
171 void readOptions(qhT *qh, int argc, char **argv, const char *promptstr, int *numInts, int *checkEvery, int *traceLevel);
172 void setupMemory(qhT *qh, int tracelevel, int numInts, int **intarray);
173 
174 void testSetappendSettruncate(qhT *qh, int numInts, int *intarray, int checkEvery);
175 void testSetdelSetadd(qhT *qh, int numInts, int *intarray, int checkEvery);
176 void testSetappendSet(qhT *qh, int numInts, int *intarray, int checkEvery);
177 void testSetcompactCopy(qhT *qh, int numInts, int *intarray, int checkEvery);
178 void testSetequalInEtc(qhT *qh, int numInts, int *intarray, int checkEvery);
179 void testSettemp(qhT *qh, int numInts, int *intarray, int checkEvery);
180 void testSetlastEtc(qhT *qh, int numInts, int *intarray, int checkEvery);
181 void testSetdelsortedEtc(qhT *qh, int numInts, int *intarray, int checkEvery);
182 
183 int log_i(qhT *qh, setT *set, const char *s, int i, int numInts, int checkEvery);
184 void checkSetContents(qhT *qh, const char *name, setT *set, int count, int rangeA, int rangeB, int rangeC);
185 
186 int main(int argc, char **argv) {
187  int *intarray= NULL;
188  int numInts;
189  int checkEvery= MAXint;
190  int curlong, totlong;
191  int traceLevel= 4; /* 4 normally, no tracing since qset does not log. Option 'T5' for memory tracing */
192  qhT qh_qh;
193  qhT *qh= &qh_qh;
194 
195 #if defined(_MSC_VER) && defined(_DEBUG) && defined(QHULL_CRTDBG) /* user_r.h */
196  _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) );
197  _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG );
198  _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDERR );
199 #endif
200 
201  readOptions(qh, argc, argv, prompt, &numInts, &checkEvery, &traceLevel);
202  setupMemory(qh, traceLevel, numInts, &intarray);
203 
204  testSetappendSettruncate(qh, numInts, intarray, checkEvery);
205  testSetdelSetadd(qh, numInts, intarray, checkEvery);
206  testSetappendSet(qh, numInts, intarray, checkEvery);
207  testSetcompactCopy(qh, numInts, intarray, checkEvery);
208  testSetequalInEtc(qh, numInts, intarray, checkEvery);
209  testSettemp(qh, numInts, intarray, checkEvery);
210  testSetlastEtc(qh, numInts, intarray, checkEvery);
211  testSetdelsortedEtc(qh, numInts, intarray, checkEvery);
212  printf("\n\nNot testing qh_setduplicate and qh_setfree2.\n These routines use heap-allocated set contents. See qhull tests.\n");
213 
214  qh_memstatistics(qh, stdout);
215  qh_memfreeshort(qh, &curlong, &totlong);
216  if (curlong || totlong){
217  qh_fprintf(qh, stderr, 8043, "qh_memfreeshort: did not free %d bytes of long memory(%d pieces)\n", totlong, curlong);
218  error_count++;
219  }
220  if(error_count){
221  qh_fprintf(qh, stderr, 8012, "testqset: %d errors\n\n", error_count);
222  exit(1);
223  }else{
224  printf("testqset_r: OK\n\n");
225  }
226  return 0;
227 }/*main*/
228 
229 void readOptions(qhT *qh, int argc, char **argv, const char *promptstr, int *numInts, int *checkEvery, int *traceLevel)
230 {
231  long numIntsArg;
232  long checkEveryArg;
233  char *endp;
234  int isTracing= 0;
235 
236  if (argc < 2 || argc > 4) {
237  printf("%s", promptstr);
238  exit(0);
239  }
240  numIntsArg= strtol(argv[1], &endp, 10);
241  if(numIntsArg<1){
242  qh_fprintf(qh, stderr, 6301, "First argument should be 1 or greater. Got '%s'\n", argv[1]);
243  exit(1);
244  }
245  if(numIntsArg>MAXint){
246  qh_fprintf(qh, stderr, 6302, "qset does not currently support 64-bit ints. Maximum count is %d\n", MAXint);
247  exit(1);
248  }
249  *numInts= (int)numIntsArg;
250 
251  if(argc==3 && argv[2][0]=='T' && argv[2][1]=='5' ){
252  isTracing= 1;
253  *traceLevel= 5;
254  }
255  if(argc==4 || (argc==3 && !isTracing)){
256  checkEveryArg= strtol(argv[2], &endp, 10);
257  if(checkEveryArg<1){
258  qh_fprintf(qh, stderr, 6321, "checkEvery argument should be 1 or greater. Got '%s'\n", argv[2]);
259  exit(1);
260  }
261  if(checkEveryArg>MAXint){
262  qh_fprintf(qh, stderr, 6322, "qset does not currently support 64-bit ints. Maximum checkEvery is %d\n", MAXint);
263  exit(1);
264  }
265  if(argc==4){
266  if(argv[3][0]=='T' && argv[3][1]=='5' ){
267  isTracing= 1;
268  *traceLevel= 5;
269  }else{
270  qh_fprintf(qh, stderr, 6242, "Optional third argument must be 'T5'. Got '%s'\n", argv[3]);
271  exit(1);
272  }
273  }
274  *checkEvery= (int)checkEveryArg;
275  }
276 }/*readOptions*/
277 
278 void setupMemory(qhT *qh, int tracelevel, int numInts, int **intarray)
279 {
280  int i;
281  if(numInts<0 || numInts*(int)sizeof(int)<0){
282  qh_fprintf(qh, stderr, 6303, "qset does not currently support 64-bit ints. Integer overflow\n");
283  exit(1);
284  }
285  *intarray= qh_malloc(numInts * sizeof(int));
286  if(!*intarray){
287  qh_fprintf(qh, stderr, 6304, "Failed to allocate %d bytes of memory\n", numInts * sizeof(int));
288  exit(1);
289  }
290  for(i= 0; i<numInts; i++){
291  (*intarray)[i] =i;
292  }
293 
294  qh_meminit(qh, stderr);
295  qh_meminitbuffers(qh, tracelevel, qh_MEMalign, 4 /*sizes*/, qh_MEMbufsize, qh_MEMinitbuf);
296  qh_memsize(qh, 10);
297  qh_memsize(qh, 20);
298  qh_memsize(qh, 30);
299  qh_memsize(qh, 40);
300  qh_memsetup(qh);
301 
302  qh_fprintf(qh, stderr, 8001, "SETelemsize is %d bytes for pointer-to-int\n", SETelemsize);
303 }/*setupMemmory*/
304 
305 void testSetappendSettruncate(qhT *qh, int numInts, int *intarray, int checkEvery)
306 {
307  setT *ints= qh_setnew(qh, 4);
308  int i, isCheck;
309 
310  qh_fprintf(qh, stderr, 8002, "\n\nTesting qh_setappend 0..%d. Test", numInts-1);
311  for(i= 0; i<numInts; i++){
312  isCheck= log_i(qh, ints, "i", i, numInts, checkEvery);
313  qh_setappend(qh, &ints, intarray+i);
314  if(isCheck){
315  checkSetContents(qh, "qh_setappend", ints, i+1, 0, -1, -1);
316  }
317  }
318 
319  qh_fprintf(qh, stderr, 8014, "\n\nTesting qh_settruncate %d and 0. Test", numInts/2);
320  if(numInts>=2){
321  isCheck= log_i(qh, ints, "n", numInts/2, numInts, checkEvery);
322  qh_settruncate(qh, ints, numInts/2);
323  checkSetContents(qh, "qh_settruncate by half", ints, numInts/2, 0, -1, -1);
324  }
325  isCheck= log_i(qh, ints, "n", 0, numInts, checkEvery);
326  qh_settruncate(qh, ints, 0);
327  checkSetContents(qh, "qh_settruncate", ints, 0, -1, -1, -1);
328 
329  qh_fprintf(qh, stderr, 8003, "\n\nTesting qh_setappend2ndlast 0,0..%d. Test 0", numInts-1);
330  qh_setfree(qh, &ints);
331  ints= qh_setnew(qh, 4);
332  qh_setappend(qh, &ints, intarray+0);
333  for(i= 0; i<numInts; i++){
334  isCheck= log_i(qh, ints, "i", i, numInts, checkEvery);
335  qh_setappend2ndlast(qh, &ints, intarray+i);
336  if(isCheck){
337  checkSetContents(qh, "qh_setappend2ndlast", ints, i+2, 0, 0, -1);
338  }
339  }
340  qh_fprintf(qh, stderr, 8015, "\n\nTesting SETtruncate_ %d and 0. Test", numInts/2);
341  if(numInts>=2){
342  isCheck= log_i(qh, ints, "n", numInts/2, numInts, checkEvery);
343  SETtruncate_(ints, numInts/2);
344  checkSetContents(qh, "SETtruncate_ by half", ints, numInts/2, 0, -1, -1);
345  }
346  isCheck= log_i(qh, ints, "n", 0, numInts, checkEvery);
347  SETtruncate_(ints, 0);
348  checkSetContents(qh, "SETtruncate_", ints, 0, -1, -1, -1);
349 
350  qh_setfree(qh, &ints);
351 }/*testSetappendSettruncate*/
352 
353 void testSetdelSetadd(qhT *qh, int numInts, int *intarray, int checkEvery)
354 {
355  setT *ints=qh_setnew(qh, 1);
356  int i,j,isCheck;
357 
358  qh_fprintf(qh, stderr, 8003, "\n\nTesting qh_setdelnthsorted and qh_setaddnth 1..%d. Test", numInts-1);
359  for(j=1; j<numInts; j++){ /* size 0 not valid */
360  if(log_i(qh, ints, "j", j, numInts, MAXint)){
361  for(i= qh_setsize(qh, ints); i<j; i++){
362  qh_setappend(qh, &ints, intarray+i);
363  }
364  checkSetContents(qh, "qh_setappend", ints, j, 0, -1, -1);
365  for(i= 0; i<j && i<100; i++){ /* otherwise too slow */
366  isCheck= log_i(qh, ints, "", i, numInts, checkEvery);
367  (void)isCheck; /* unused */
369  qh_setaddnth(qh, &ints, i, intarray+i);
370  if(checkEvery==1){
371  checkSetContents(qh, "qh_setdelnthsorted qh_setaddnth", ints, j, 0, -1, -1);
372  }
373  }
374  checkSetContents(qh, "qh_setdelnthsorted qh_setaddnth 2", ints, j, 0, -1, -1);
375  }
376  }
377  qh_setfree(qh, &ints);
378 }/*testSetdelSetadd*/
379 
380 void testSetappendSet(qhT *qh, int numInts, int *intarray, int checkEvery)
381 {
382  setT *ints=qh_setnew(qh, 1);
383  setT *ints2;
384  int i,j,k;
385 
386  qh_fprintf(qh, stderr, 8016, "\n\nTesting qh_setappend_set 0..%d. Test", numInts-1);
387  for(j=0; j<numInts; j++){
388  if(log_i(qh, ints, "j", j, numInts, numInts)){
389  for(i= qh_setsize(qh, ints); i<j; i++){
390  qh_setappend(qh, &ints, intarray+i);
391  }
392  if(checkEvery==1){
393  checkSetContents(qh, "qh_setappend", ints, j, 0, -1, -1);
394  }
395  ints2= qh_setnew(qh, j==0 ? 0 : j-1); /* One less than needed */
396  for(i= 0; i<=j && i<=20; i++){ /* otherwise too slow */
397  if(log_i(qh, ints, "", i, numInts, numInts)){
398  for(k= qh_setsize(qh, ints2); k<i; k++){
399  qh_setappend(qh, &ints2, intarray+k);
400  }
401  if(checkEvery==1){
402  checkSetContents(qh, "qh_setappend 2", ints2, i, 0, -1, -1);
403  }
404  qh_setappend_set(qh, &ints, ints2);
405  checkSetContents(qh, "qh_setappend_set", ints, i+j, 0, (j==0 ? -1 : 0), -1);
406  qh_settruncate(qh, ints, j);
407  if(checkEvery==1){
408  checkSetContents(qh, "qh_settruncate", ints, j, 0, -1, -1);
409  }
410  }
411  }
412  qh_setfree(qh, &ints2);
413  }
414  }
415  qh_setfree(qh, &ints);
416 }/*testSetappendSet*/
417 
418 void testSetcompactCopy(qhT *qh, int numInts, int *intarray, int checkEvery)
419 {
420  setT *ints= qh_setnew(qh, 20);
421  setT *ints2= NULL;
422  int i,j,k;
423 
424  qh_fprintf(qh, stderr, 8017, "\n\nTesting qh_setcompact and qh_setcopy 0..%d. Test", numInts-1);
425  for(j=0; j<numInts; j++){
426  if(log_i(qh, ints, "j", j, numInts, checkEvery)){
427  for(i= qh_setsize(qh, ints); i<j; i++){ /* Test i<j to test the empty set */
428  for(k= 0; k<i%7; k++){
429  qh_setappend(qh, &ints, NULL);
430  }
431  qh_setappend(qh, &ints, intarray+i);
432  }
433  qh_setfree(qh, &ints2);
434  ints2= qh_setcopy(qh, ints, 0);
436  qh_setcompact(qh, ints2);
437  checkSetContents(qh, "qh_setcompact", ints, j, 0, 0, -1);
438  checkSetContents(qh, "qh_setcompact", ints2, j, 0, 0, -1);
440  checkSetContents(qh, "qh_setcompact", ints, j, 0, 0, -1);
441  }
442  }
443  qh_setfree(qh, &ints);
444  qh_setfree(qh, &ints2);
445 }/*testSetcompactCopy*/
446 
447 void testSetdelsortedEtc(qhT *qh, int numInts, int *intarray, int checkEvery)
448 {
449  setT *ints= qh_setnew(qh, 1);
450  setT *ints2= NULL;
451  int i,j;
452 
453  qh_fprintf(qh, stderr, 8018, "\n\nTesting qh_setdel*, qh_setaddsorted, and 0..%d. Test", numInts-1);
454  for(j=0; j<numInts; j++){
455  if(log_i(qh, ints, "j", j, numInts, checkEvery)){
456  for(i= qh_setsize(qh, ints); i<j; i++){ /* Test i<j to test the empty set */
457  qh_setaddsorted(qh, &ints, intarray+i);
458  }
459  checkSetContents(qh, "qh_setaddsorted", ints, j, 0, 0, -1);
460  if(j>3){
461  qh_setdelsorted(ints, intarray+i/2);
462  checkSetContents(qh, "qh_setdelsorted", ints, j-1, 0, i/2+1, -1);
463  qh_setaddsorted(qh, &ints, intarray+i/2);
464  checkSetContents(qh, "qh_setaddsorted i/2", ints, j, 0, 0, -1);
465  }
467  checkSetContents(qh, "qh_setdellast", ints, (j ? j-1 : 0), 0, -1, -1);
468  if(j>0){
469  qh_setaddsorted(qh, &ints, intarray+j-1);
470  checkSetContents(qh, "qh_setaddsorted j-1", ints, j, 0, -1, -1);
471  }
472  if(j>4){
473  qh_setdelnthsorted(qh, ints, i/2);
474  if (checkEvery==1)
475  checkSetContents(qh, "qh_setdelnthsorted", ints, j-1, 0, i/2+1, -1);
476  /* test qh_setdelnth and move-to-front */
477  qh_setdelsorted(ints, intarray+i/2+1);
478  checkSetContents(qh, "qh_setdelsorted 2", ints, j-2, 0, i/2+2, -1);
479  qh_setaddsorted(qh, &ints, intarray+i/2+1);
480  if (checkEvery==1)
481  checkSetContents(qh, "qh_setaddsorted i/2+1", ints, j-1, 0, i/2+1, -1);
482  qh_setaddsorted(qh, &ints, intarray+i/2);
483  checkSetContents(qh, "qh_setaddsorted i/2 again", ints, j, 0, -1, -1);
484  }
485  qh_setfree(qh, &ints2);
486  ints2= qh_setcopy(qh, ints, 0);
488  qh_setcompact(qh, ints2);
489  checkSetContents(qh, "qh_setcompact", ints, j, 0, 0, -1);
490  checkSetContents(qh, "qh_setcompact 2", ints2, j, 0, 0, -1);
492  checkSetContents(qh, "qh_setcompact 3", ints, j, 0, 0, -1);
493  qh_setfree(qh, &ints2);
494  }
495  }
497  if(ints){
498  qh_setfree(qh, &ints); /* Was quick memory */
499  }
500 }/*testSetdelsortedEtc*/
501 
502 void testSetequalInEtc(qhT *qh, int numInts, int *intarray, int checkEvery)
503 {
504  setT *ints= NULL;
505  setT *ints2= NULL;
506  setT *ints3= NULL;
507  int i,j,n;
508 
509  qh_fprintf(qh, stderr, 8019, "\n\nTesting qh_setequal*, qh_setin*, qh_setdel, qh_setdelnth, and qh_setlarger 0..%d. Test", numInts-1);
510  for(j=0; j<numInts; j++){
511  if(log_i(qh, ints, "j", j, numInts, checkEvery)){
512  n= qh_setsize(qh, ints);
513  qh_setlarger(qh, &ints);
514  checkSetContents(qh, "qh_setlarger", ints, n, 0, -1, -1);
515  for(i= qh_setsize(qh, ints); i<j; i++){ /* Test i<j to test the empty set */
516  qh_setappend(qh, &ints, intarray+i);
517  }
518  checkSetContents(qh, "qh_setappend", ints, j, 0, -1, -1);
519  if(!qh_setequal(ints, ints)){
520  qh_fprintf(qh, stderr, 6300, "testSetequalInEtc: set not equal to itself at length %d\n", j);
521  error_count++;
522  }
523  if(j==0 && !qh_setequal(ints, ints2)){
524  qh_fprintf(qh, stderr, 6323, "testSetequalInEtc: empty set not equal to null set\n");
525  error_count++;
526  }
527  if(j>0){
528  if(qh_setequal(ints, ints2)){
529  qh_fprintf(qh, stderr, 6324, "testSetequalInEtc: non-empty set equal to empty set\n", j);
530  error_count++;
531  }
532  qh_setfree(qh, &ints3);
533  ints3= qh_setcopy(qh, ints, 0);
534  checkSetContents(qh, "qh_setreplace", ints3, j, 0, -1, -1);
535  qh_setreplace(qh, ints3, intarray+j/2, intarray+j/2+1);
536  if(j==1){
537  checkSetContents(qh, "qh_setreplace 2", ints3, j, j/2+1, -1, -1);
538  }else if(j==2){
539  checkSetContents(qh, "qh_setreplace 3", ints3, j, 0, j/2+1, -1);
540  }else{
541  checkSetContents(qh, "qh_setreplace 3", ints3, j, 0, j/2+1, j/2+1);
542  }
543  if(qh_setequal(ints, ints3)){
544  qh_fprintf(qh, stderr, 6325, "testSetequalInEtc: modified set equal to original set at %d/2\n", j);
545  error_count++;
546  }
547  if(!qh_setequal_except(ints, intarray+j/2, ints3, intarray+j/2+1)){
548  qh_fprintf(qh, stderr, 6326, "qh_setequal_except: modified set not equal to original set except modified\n", j);
549  error_count++;
550  }
551  if(qh_setequal_except(ints, intarray+j/2, ints3, intarray)){
552  qh_fprintf(qh, stderr, 6327, "qh_setequal_except: modified set equal to original set with wrong excepts\n", j);
553  error_count++;
554  }
555  if(!qh_setequal_skip(ints, j/2, ints3, j/2)){
556  qh_fprintf(qh, stderr, 6328, "qh_setequal_skip: modified set not equal to original set except modified\n", j);
557  error_count++;
558  }
559  if(j>2 && qh_setequal_skip(ints, j/2, ints3, 0)){
560  qh_fprintf(qh, stderr, 6329, "qh_setequal_skip: modified set equal to original set with wrong excepts\n", j);
561  error_count++;
562  }
563  if(intarray+j/2+1!=qh_setdel(ints3, intarray+j/2+1)){
564  qh_fprintf(qh, stderr, 6330, "qh_setdel: failed to find added element\n", j);
565  error_count++;
566  }
567  checkSetContents(qh, "qh_setdel", ints3, j-1, 0, j-1, (j==1 ? -1 : j/2+1)); /* swaps last element with deleted element */
568  if(j>3){
569  qh_setdelnth(qh, ints3, j/2); /* Delete at the same location as the original replace, for only one out-of-order element */
570  checkSetContents(qh, "qh_setdelnth", ints3, j-2, 0, j-2, (j==2 ? -1 : j/2+1));
571  }
572  if(qh_setin(ints3, intarray+j/2)){
573  qh_fprintf(qh, stderr, 6331, "qh_setin: found deleted element\n");
574  error_count++;
575  }
576  if(j>4 && !qh_setin(ints3, intarray+1)){
577  qh_fprintf(qh, stderr, 6332, "qh_setin: did not find second element\n");
578  error_count++;
579  }
580  if(j>4 && !qh_setin(ints3, intarray+j-2)){
581  qh_fprintf(qh, stderr, 6333, "qh_setin: did not find last element\n");
582  error_count++;
583  }
584  if(-1!=qh_setindex(ints2, intarray)){
585  qh_fprintf(qh, stderr, 6334, "qh_setindex: found element in empty set\n");
586  error_count++;
587  }
588  if(-1!=qh_setindex(ints3, intarray+j/2)){
589  qh_fprintf(qh, stderr, 6335, "qh_setindex: found deleted element in set\n");
590  error_count++;
591  }
592  if(0!=qh_setindex(ints, intarray)){
593  qh_fprintf(qh, stderr, 6336, "qh_setindex: did not find first in set\n");
594  error_count++;
595  }
596  if(j-1!=qh_setindex(ints, intarray+j-1)){
597  qh_fprintf(qh, stderr, 6337, "qh_setindex: did not find last in set\n");
598  error_count++;
599  }
600  }
601  qh_setfree(qh, &ints2);
602  }
603  }
604  qh_setfree(qh, &ints3);
606  if(ints){
607  qh_setfree(qh, &ints); /* Was quick memory */
608  }
609 }/*testSetequalInEtc*/
610 
611 
612 void testSetlastEtc(qhT *qh, int numInts, int *intarray, int checkEvery)
613 {
614  setT *ints= NULL;
615  setT *ints2= NULL;
616  int i,j,prepend;
617 
618  qh_fprintf(qh, stderr, 8020, "\n\nTesting qh_setlast, qh_setnew_delnthsorted, qh_setunique, and qh_setzero 0..%d. Test", numInts-1);
619  for(j=0; j<numInts; j++){
620  if(log_i(qh, ints, "j", j, numInts, checkEvery)){
621  for(i= qh_setsize(qh, ints); i<j; i++){ /* Test i<j to test the empty set */
622  if(!qh_setunique(qh, &ints, intarray+i)){
623  qh_fprintf(qh, stderr, 6340, "qh_setunique: not able to append next element %d\n", i);
624  error_count++;
625  }
626  if(checkEvery==1){
627  checkSetContents(qh, "qh_setunique", ints, i+1, 0, -1, -1);
628  }
629  if(qh_setunique(qh, &ints, intarray+i)){
630  qh_fprintf(qh, stderr, 6341, "qh_setunique: appended next element twice %d\n", i);
631  error_count++;
632  }
633  if(qh_setunique(qh, &ints, intarray+i/2)){
634  qh_fprintf(qh, stderr, 6346, "qh_setunique: appended middle element twice %d/2\n", i);
635  error_count++;
636  }
637  }
638  checkSetContents(qh, "qh_setunique 2", ints, j, 0, -1, -1);
639  if(j==0 && NULL!=qh_setlast(ints)){
640  qh_fprintf(qh, stderr, 6339, "qh_setlast: returned last element of empty set\n");
641  error_count++;
642  }
643  if(j>0){
644  if(intarray+j-1!=qh_setlast(ints)){
645  qh_fprintf(qh, stderr, 6338, "qh_setlast: wrong last element\n");
646  error_count++;
647  }
648  prepend= (j<100 ? j/4 : 0);
649  ints2= qh_setnew_delnthsorted(qh, ints, qh_setsize(qh, ints), j/2, prepend);
650  if(qh_setsize(qh, ints2)!=j+prepend-1){
651  qh_fprintf(qh, stderr, 6345, "qh_setnew_delnthsorted: Expecting %d elements, got %d\n", j+prepend-1, qh_setsize(qh, ints2));
652  error_count++;
653  }
654  /* Define prepended elements. Otherwise qh_setdelnthsorted may fail */
655  for(i= 0; i<prepend; i++){
656  void **p= &SETelem_(ints2, i);
657  *p= intarray+0;
658  }
659  for(i= 0; i<prepend; i++){
660  qh_setdelnthsorted(qh, ints2, 0); /* delete undefined prefix */
661  }
662  checkSetContents(qh, "qh_setnew_delnthsorted", ints2, j-1, 0, j/2+1, -1);
663  if(j>2){
664  qh_setzero(qh, ints2, j/2, j-1); /* max size may be j-1 */
665  if(qh_setsize(qh, ints2)!=j-1){
666  qh_fprintf(qh, stderr, 6342, "qh_setzero: Expecting %d elements, got %d\n", j, qh_setsize(qh, ints2));
667  error_count++;
668  }
669  qh_setcompact(qh, ints2);
670  checkSetContents(qh, "qh_setzero", ints2, j/2, 0, -1, -1);
671  }
672  }
673  qh_setfree(qh, &ints2);
674  }
675  }
677  if(ints){
678  qh_setfree(qh, &ints); /* Was quick memory */
679  }
680 }/*testSetlastEtc*/
681 
682 void testSettemp(qhT *qh, int numInts, int *intarray, int checkEvery)
683 {
684  setT *ints= NULL;
685  setT *ints2= NULL;
686  setT *ints3= NULL;
687  int i,j;
688 
689  qh_fprintf(qh, stderr, 8021, "\n\nTesting qh_settemp* 0..%d. Test", numInts-1);
690  for(j=0; j<numInts; j++){
691  if(log_i(qh, ints, "j", j, numInts, checkEvery)){
692  if(j<20){
693  for(i=0; i<j; i++){
694  ints2= qh_settemp(qh, j);
695  }
697  }
698  for(i= qh_setsize(qh, ints); i<j; i++){ /* Test i<j to test the empty set */
699  qh_setappend(qh, &ints, intarray+i);
700  }
701  ints2= qh_settemp(qh, j);
702  if(j>0){
704  ints3= qh_settemppop(qh);
705  if(ints!=ints3){
706  qh_fprintf(qh, stderr, 6343, "qh_settemppop: didn't pop the push\n");
707  error_count++;
708  }
709  }
710  qh_settempfree(qh, &ints2);
711  }
712  }
714  if(ints){
715  qh_setfree(qh, &ints); /* Was quick memory */
716  }
717 }/*testSettemp*/
718 
719 /* Check that a set contains count elements
720  Ranges are consecutive (e.g., 1,2,3,...) starting with first, mid, and last
721  Use -1 for missing ranges
722  Returns -1 if should check results
723 */
724 int log_i(qhT *qh, setT *set, const char *s, int i, int numInts, int checkEvery)
725 {
726  int j= i;
727  int scale= 1;
728  int e= 0;
729  int *i2, **i2p;
730 
731  if(*s || checkEvery==1){
732  if(i<10){
733  qh_fprintf(qh, stderr, 8004, " %s%d", s, i);
734  }else{
735  if(i==11 && checkEvery==1){
736  qh_fprintf(qh, stderr, 8005, "\nResults after 10: ");
737  FOREACHint_(set){
738  qh_fprintf(qh, stderr, 8006, " %d", *i2);
739  }
740  qh_fprintf(qh, stderr, 8007, " Continue");
741  }
742  while((j= j/10)>=1){
743  scale *= 10;
744  e++;
745  }
746  if(i==numInts-1){
747  qh_fprintf(qh, stderr, 8008, " %s%d", s, i);
748  }else if(i==scale){
749  if(i<=1000){
750  qh_fprintf(qh, stderr, 8010, " %s%d", s, i);
751  }else{
752  qh_fprintf(qh, stderr, 8009, " %s1e%d", s, e);
753  }
754  }
755  }
756  }
757  if(i<1000 || i%checkEvery==0 || i== scale || i==numInts-1){
758  return 1;
759  }
760  return 0;
761 }/*log_i*/
762 
763 /* Check that a set contains count elements
764  Ranges are consecutive (e.g., 1,2,3,...) starting with first, mid, and last
765  Use -1 for missing ranges
766 */
767 void checkSetContents(qhT *qh, const char *name, setT *set, int count, int rangeA, int rangeB, int rangeC)
768 {
769 
770  i2T *i2, **i2p;
771  int i2_i, i2_n;
772  int prev= -1; /* avoid warning */
773  int i;
774  int first= -3;
775  int second= -3;
776  int rangeCount=1;
777  int actualSize= 0;
778 
779  qh_setcheck(qh, set, name, 0);
780  if(set){
781  SETreturnsize_(set, actualSize); /* normally used only when speed is critical */
782  if(*qh_setendpointer(set)!=NULL){
783  qh_fprintf(qh, stderr, 6344, "%s: qh_setendpointer(set), 0x%x, is not NULL terminator of set 0x%x", name, qh_setendpointer(set), set);
784  error_count++;
785  }
786  }
787  if(actualSize!=qh_setsize(qh, set)){
788  qh_fprintf(qh, stderr, 6305, "%s: SETreturnsize_(qh) returned %d while qh_setsize(qh) returns %d\n", name, actualSize, qh_setsize(qh, set));
789  error_count++;
790  }else if(actualSize!=count){
791  qh_fprintf(qh, stderr, 6306, "%s: Expecting %d elements for set. Got %d elements\n", name, count, actualSize);
792  error_count++;
793  }
794  if(SETempty_(set)){
795  if(count!=0){
796  qh_fprintf(qh, stderr, 6307, "%s: Got empty set instead of count %d, rangeA %d, rangeB %d, rangeC %d\n", name, count, rangeA, rangeB, rangeC);
797  error_count++;
798  }
799  }else{
800  /* Must be first, otherwise trips msvc 8 */
801  i2T **p= SETaddr_(set, i2T);
802  if(*p!=SETfirstt_(set, i2T)){
803  qh_fprintf(qh, stderr, 6309, "%s: SETaddr_(set, i2t) [%p] is not the same as SETfirst_(set) [%p]\n", name, SETaddr_(set, i2T), SETfirst_(set));
804  error_count++;
805  }
806  first= *(int *)SETfirst_(set);
807  if(SETfirst_(set)!=SETfirstt_(set, i2T)){
808  qh_fprintf(qh, stderr, 6308, "%s: SETfirst_(set) [%p] is not the same as SETfirstt_(set, i2T [%p]\n", name, SETfirst_(set), SETfirstt_(set, i2T));
809  error_count++;
810  }
811  if(qh_setsize(qh, set)>1){
812  second= *(int *)SETsecond_(set);
813  if(SETsecond_(set)!=SETsecondt_(set, i2T)){
814  qh_fprintf(qh, stderr, 6310, "%s: SETsecond_(set) [%p] is not the same as SETsecondt_(set, i2T) [%p]\n", name, SETsecond_(set), SETsecondt_(set, i2T));
815  error_count++;
816  }
817  }
818  }
819  /* Test first run of ints in set*/
820  i= 0;
821  FOREACHint_(set){
822  if(i2!=SETfirst_(set) && *i2!=prev+1){
823  break;
824  }
825  prev= *i2;
826  if(SETindex_(set, i2)!=i){
827  qh_fprintf(qh, stderr, 6311, "%s: Expecting SETindex_(set, pointer-to-%d) to be %d. Got %d\n", name, *i2, i, SETindex_(set, i2));
828  error_count++;;
829  }
830  if(i2!=SETref_(i2)){
831  qh_fprintf(qh, stderr, 6312, "%s: SETref_(i2) [%p] does not point to i2 (the %d'th element)\n", name, SETref_(i2), i);
832  error_count++;;
833  }
834  i++;
835  }
836  FOREACHint_i_(qh, set){
837  /* Must be first conditional, otherwise it trips up msvc 8 */
838  i2T **p= SETelemaddr_(set, i2_i, i2T);
839  if(i2!=*p){
840  qh_fprintf(qh, stderr, 6320, "%s: SETelemaddr_(set, %d, i2T) [%p] does not point to i2\n", name, i2_i, SETelemaddr_(set, i2_i, int));
841  error_count++;;
842  }
843  if(i2_i==0){
844  if(first!=*i2){
845  qh_fprintf(qh, stderr, 6314, "%s: First element is %d instead of SETfirst %d\n", name, *i2, first);
846  error_count++;;
847  }
848  if(rangeA!=*i2){
849  qh_fprintf(qh, stderr, 6315, "%s: starts with %d instead of rangeA %d\n", name, *i2, rangeA);
850  error_count++;;
851  }
852  prev= rangeA;
853  }else{
854  if(i2_i==1 && second!=*i2){
855  qh_fprintf(qh, stderr, 6316, "%s: Second element is %d instead of SETsecond %d\n", name, *i2, second);
856  error_count++;;
857  }
858  if(prev+1==*i2){
859  prev++;
860  }else{
861  if(*i2==rangeB){
862  prev= rangeB;
863  rangeB= -1;
864  rangeCount++;
865  }else if(rangeB==-1 && *i2==rangeC){
866  prev= rangeC;
867  rangeC= -1;
868  rangeCount++;
869  }else{
870  prev++;
871  qh_fprintf(qh, stderr, 6317, "%s: Expecting %d'th element to be %d. Got %d\n", name, i2_i, prev, *i2);
872  error_count++;
873  }
874  }
875  }
876  if(i2!=SETelem_(set, i2_i)){
877  qh_fprintf(qh, stderr, 6318, "%s: SETelem_(set, %d) [%p] is not i2 [%p] (the %d'th element)\n", name, i2_i, SETelem_(set, i2_i), i2, i2_i);
878  error_count++;;
879  }
880  if(SETelemt_(set, i2_i, i2T)!=SETelem_(set, i2_i)){ /* Normally SETelemt_ is used for generic sets */
881  qh_fprintf(qh, stderr, 6319, "%s: SETelemt_(set, %d, i2T) [%p] is not SETelem_(set, %d) [%p] (the %d'th element)\n", name, i2_i, SETelemt_(set, i2_i, int), i2_i, SETelem_(set, i2_i), i2_i);
882  error_count++;;
883  }
884  }
886  qh_fprintf(qh, stderr, 8011, "testqset: Stop testing after %d errors\n", error_count);
887  exit(1);
888  }
889 }/*checkSetContents*/
890 
SETref_
#define SETref_(elem)
Definition: qset.h:319
i2T
int i2T
Definition: testqset.c:83
qh_setdelsorted
void * qh_setdelsorted(setT *set, void *oldelem)
Definition: qset.c:504
qh_MEMbufsize
#define qh_MEMbufsize
Definition: user.h:456
qh_meminitbuffers
void qh_meminitbuffers(int tracelevel, int alignment, int numsizes, int bufsize, int bufinit)
Definition: mem.c:346
qh_free
void qh_free(void *mem)
Definition: usermem.c:77
qh_setappend_set
void qh_setappend_set(setT **setp, setT *setA)
Definition: qset.c:163
obb.fmt
fmt
Definition: obb.py:145
qh_setfreelong
void qh_setfreelong(setT **setp)
Definition: qset.c:770
main
int main(int argc, char **argv)
Definition: testqset_r.c:186
qh_setdelnthsorted
void * qh_setdelnthsorted(setT *set, int nth)
Definition: qset.c:465
FOREACHint_
#define FOREACHint_(ints)
Definition: testqset_r.c:87
checkSetContents
void checkSetContents(qhT *qh, const char *name, setT *set, int count, int rangeA, int rangeB, int rangeC)
Definition: testqset_r.c:767
SETelemaddr_
#define SETelemaddr_(set, n, type)
Definition: qset.h:353
testSetcompactCopy
void testSetcompactCopy(qhT *qh, int numInts, int *intarray, int checkEvery)
Definition: testqset_r.c:418
qh_setdel
void * qh_setdel(setT *set, void *oldelem)
Definition: qset.c:344
qh_setunique
int qh_setunique(setT **set, void *elem)
Definition: qset.c:1299
qh_settemppush
void qh_settemppush(setT *set)
Definition: qset.c:1247
qh_setdelnth
void * qh_setdelnth(setT *set, int nth)
Definition: qset.c:424
testSettemp
void testSettemp(qhT *qh, int numInts, int *intarray, int checkEvery)
Definition: testqset_r.c:682
qh_setlast
void * qh_setlast(setT *set)
Definition: qset.c:895
qh_setfree
void qh_setfree(setT **setp)
Definition: qset.c:716
qh_setlarger
void qh_setlarger(setT **oldsetp)
Definition: qset.c:855
qh_setcopy
setT * qh_setcopy(setT *set, int extra)
Definition: qset.c:310
SETsecondt_
#define SETsecondt_(set, type)
Definition: qset.h:388
MAXint
@ MAXint
Definition: testqset_r.c:94
qh_setappend2ndlast
void qh_setappend2ndlast(setT **setp, void *newelem)
Definition: qset.c:207
qhT
Definition: libqhull.h:465
octree.r
r
Definition: octree.py:9
qh_memsize
void qh_memsize(int size)
Definition: mem.c:404
facetT
Definition: libqhull.h:262
SETelemt_
#define SETelemt_(set, n, type)
Definition: qset.h:342
qh_setappend
void qh_setappend(setT **setp, void *newelem)
Definition: qset.c:131
MAXerrorCount
#define MAXerrorCount
Definition: testqset_r.c:85
qh_qh
qhT qh_qh
Definition: global.c:26
doxygen_xml_parser.args
args
Definition: doxygen_xml_parser.py:884
qh_setdellast
void * qh_setdellast(setT *set)
Definition: qset.c:384
SETreturnsize_
#define SETreturnsize_(set, size)
Definition: qset.h:408
qh_settemp
setT * qh_settemp(int setsize)
Definition: qset.c:1146
qh_settruncate
void qh_settruncate(setT *set, int size)
Definition: qset.c:1275
setT
Definition: qset.h:83
qh_exit
void qh_exit(int exitcode)
Definition: usermem.c:38
log_i
int log_i(qhT *qh, setT *set, const char *s, int i, int numInts, int checkEvery)
Definition: testqset_r.c:724
qh_setequal_skip
int qh_setequal_skip(setT *setA, int skipA, setT *setB, int skipB)
Definition: qset.c:677
libqhull_r.h
qh
#define qh
Definition: libqhull.h:457
SETelem_
#define SETelem_(set, n)
Definition: qset.h:331
qh_setequal_except
int qh_setequal_except(setT *setA, void *skipelemA, setT *setB, void *skipelemB)
Definition: qset.c:629
qh_setequal
int qh_setequal(setT *setA, setT *setB)
Definition: qset.c:587
qh_setsize
int qh_setsize(setT *set)
Definition: qset.c:1111
testSetequalInEtc
void testSetequalInEtc(qhT *qh, int numInts, int *intarray, int checkEvery)
Definition: testqset_r.c:502
SETtruncate_
#define SETtruncate_(set, size)
Definition: qset.h:445
qh_fprintf
void qh_fprintf(qhT *qh, FILE *fp, int msgcode, const char *fmt,...)
Definition: testqset_r.c:136
prompt
char prompt[]
Definition: testqset_r.c:97
ridgeT
Definition: libqhull.h:371
qh_setaddsorted
void qh_setaddsorted(setT **setp, void *newelem)
Definition: qset.c:100
qh_MEMalign
#define qh_MEMalign
Definition: user.h:445
SETfirst_
#define SETfirst_(set)
Definition: qset.h:362
SETsecond_
#define SETsecond_(set)
Definition: qset.h:380
error_count
int error_count
Definition: testqset_r.c:110
qh_settemppop
setT * qh_settemppop(void)
Definition: qset.c:1221
name
name
qh_setnew
setT * qh_setnew(int setsize)
Definition: qset.c:924
testSetdelSetadd
void testSetdelSetadd(qhT *qh, int numInts, int *intarray, int checkEvery)
Definition: testqset_r.c:353
SETaddr_
#define SETaddr_(set, type)
Definition: qset.h:396
SETelemsize
#define SETelemsize
Definition: qset.h:100
testSetlastEtc
void testSetlastEtc(qhT *qh, int numInts, int *intarray, int checkEvery)
Definition: testqset_r.c:612
qh_MEMinitbuf
#define qh_MEMinitbuf
Definition: user.h:467
readOptions
void readOptions(qhT *qh, int argc, char **argv, const char *promptstr, int *numInts, int *checkEvery, int *traceLevel)
Definition: testqset_r.c:229
user_r.h
SETempty_
#define SETempty_(set)
Definition: qset.h:419
qh_setreplace
void qh_setreplace(setT *set, void *oldelem, void *newelem)
Definition: qset.c:1080
qh_settempfree_all
void qh_settempfree_all(void)
Definition: qset.c:1201
setupMemory
void setupMemory(qhT *qh, int tracelevel, int numInts, int **intarray)
Definition: testqset_r.c:278
SETfirstt_
#define SETfirstt_(set, type)
Definition: qset.h:371
qh_memfreeshort
void qh_memfreeshort(int *curlong, int *totlong)
Definition: mem.c:288
qh_settempfree
void qh_settempfree(setT **set)
Definition: qset.c:1174
testSetappendSet
void testSetappendSet(qhT *qh, int numInts, int *intarray, int checkEvery)
Definition: testqset_r.c:380
i2T
int i2T
Definition: testqset_r.c:84
ints
ints
qh_memsetup
void qh_memsetup(void)
Definition: mem.c:373
qh_setaddnth
void qh_setaddnth(setT **setp, int nth, void *newelem)
Definition: qset.c:61
mem_r.h
qh_setindex
int qh_setindex(setT *set, void *atelem)
Definition: qset.c:821
qh_setendpointer
void ** qh_setendpointer(setT *set)
Definition: qset.c:566
qh_setzero
void qh_setzero(setT *set, int idx, int size)
Definition: qset.c:1327
qh_meminit
void qh_meminit(FILE *ferr)
Definition: mem.c:317
testSetappendSettruncate
void testSetappendSettruncate(qhT *qh, int numInts, int *intarray, int checkEvery)
Definition: testqset_r.c:305
qh_fprintf_stderr
void qh_fprintf_stderr(int msgcode, const char *fmt,...)
Definition: usermem.c:57
SETindex_
#define SETindex_(set, elem)
Definition: qset.h:308
qh_errexit
void qh_errexit(qhT *qh, int exitcode, facetT *f, ridgeT *r)
Definition: testqset_r.c:126
FOREACHint_i_
#define FOREACHint_i_(qh, ints)
Definition: testqset_r.c:89
testSetdelsortedEtc
void testSetdelsortedEtc(qhT *qh, int numInts, int *intarray, int checkEvery)
Definition: testqset_r.c:447
qh_setnew_delnthsorted
setT * qh_setnew_delnthsorted(setT *set, int size, int nth, int prepend)
Definition: qset.c:967
qh_setin
int qh_setin(setT *set, void *setelem)
Definition: qset.c:795
qh_setcompact
void qh_setcompact(setT *set)
Definition: qset.c:276
qset_r.h
qh_memstatistics
void qh_memstatistics(FILE *fp)
Definition: mem.c:431
qh_setcheck
void qh_setcheck(setT *set, const char *tname, unsigned id)
Definition: qset.c:234
qh_malloc
void * qh_malloc(size_t size)
Definition: usermem.c:90


hpp-fcl
Author(s):
autogenerated on Fri Jan 26 2024 03:46:15