TPCCLIB
Loading...
Searching...
No Matches
libtpcfcmc.c
1/******************************************************************************
2 * This file is not compiled into the library, but it contains main()
3 * which is compiled to an executable, used to test the library functions.
4 *****************************************************************************/
5
6/*****************************************************************************/
7#include "tpcclibConfig.h"
8/*****************************************************************************/
9#include <stdio.h>
10#include <stdlib.h>
11#include <math.h>
12#include <time.h>
13#include <string.h>
14#include <ctype.h>
15#include <unistd.h>
16/*****************************************************************************/
17#include "tpcextensions.h"
18#include "tpccsv.h"
19/*****************************************************************************/
20#include "tpcfcmc.h"
21#include "test_tpcfcmc.h"
22/*****************************************************************************/
23
24/*****************************************************************************/
25static char *info[] = {
26 "Usage: @P [options]",
27 " ",
28 "Options:",
29 " -stdoptions", // List standard options like --help, -v, etc
30 " -t, --test",
31 " Run all tests for library functions.",
32 0};
33/*****************************************************************************/
34
35/*****************************************************************************/
40int main(
42 int argc,
44 char *argv[ ]
45) {
46 int i, help=0, version=0, verbose=1, error=0, test=0;
47 int ret;
48 char *cptr;
49
50 if(argc==1) {tpcPrintUsage(argv[0], info, stdout); return(0);}
51 for(i=1; i<argc; i++) {
52 if(tpcProcessStdOptions(argv[i], &help, &version, &verbose)==0) continue;
53 cptr=argv[i]; if(*cptr=='-') cptr++; if(*cptr=='-') cptr++;
54 if(strncasecmp(cptr, "TEST", 1)==0) {
55 test=1; continue;
56 } else {
57 error++; break;
58 }
59 }
60 if(error>0) {
61 fprintf(stderr, "Error: specify --help for usage.\n");
62 return(1);
63 }
64 /* Print help or version? */
65 if(help) {tpcPrintUsage(argv[0], info, stdout); return(0);}
66 if(version) {tpcPrintBuild(argv[0], stdout); return(0);}
67
68 if(test==0) return(0);
69
70 if(verbose>0) printf("running tests for library functions...\n");
71 i=10;
72 /* fcmc */
73 i++; if((ret=test_fcmcInit(verbose))!=0) {
74 fprintf(stderr, "failed (%d).\n", ret); return(i);}
75 i++; if((ret=test_fcmcFree(verbose))!=0) {
76 fprintf(stderr, "failed (%d).\n", ret); return(i);}
77 i++; if((ret=test_fcmcAllocate(verbose))!=0) {
78 fprintf(stderr, "failed (%d).\n", ret); return(i);}
79 i++; if((ret=test_fcmclustering(verbose))!=0) {
80 fprintf(stderr, "failed (%d).\n", ret); return(i);}
81
82 if(verbose>0) printf("\nAll tests passed.\n\n");
83 return(0);
84}
85/*****************************************************************************/
86
87/*****************************************************************************/
int tpcProcessStdOptions(const char *s, int *print_usage, int *print_version, int *verbose_level)
Definition proginfo.c:47
void tpcPrintBuild(const char *program, FILE *fp)
Definition proginfo.c:339
void tpcPrintUsage(const char *program, char *text[], FILE *fp)
Definition proginfo.c:114
Header file for library libtpccsv.
Header file for library libtpcextensions.
Header file for library libtpcfcmc.