My Project
test_bufsize.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "kernel/mod2.h"
5 #include "mlpredict.h"
6 
7 #if defined(HAVE_READLINE) && defined(HAVE_READLINE_READLINE_H)
8 #ifdef HAVE_PYTHON
9 int main(int argc, char *argv[])
10 {
11  int i = 0;
12  int k = 0;
13  int length[5];
14  char *buffer[5];
15  if (argc != 1) {
16  printf("Usage: %s\n", argv[0]);
17  return 1;
18  }
19 
20  i = ml_initialise();
21  if (i != 1)
22  {
23  printf("Cannot test - initialization failed\n");
24  return 0;
25  }
26 
27  i = system("echo \"ring\" > test.txt");
28  if (i != 0) return 1;
29 
30  i = ml_make_prediction("test.txt", buffer, length, strdup);
31  printf("Returnvalue for ml_make_prediciton: \t%d\n", i);
32  for (k = 0; k < 5; k++) {
33  printf("String %d in buffer: \t\t%s\n", k, buffer[k]);
34  }
35  if (i != 1) return 1;
36  for (k = 0; k < 5; k++) {
37  if ((int)strlen(buffer[k]) != length[k])
38  return 1;
39  }
40  if (strcmp(buffer[0], "sing_29.htm")) return 1;
41  if (length[0] != 11) return 1;
42 
43  i = ml_finalise();
44  if (i != 1) return 1;
45 
46  return 0;
47 }
48 #else /*!HAVE_PYTHON*/
49 int main(int argc, char *argv[])
50 {
51  return 0;
52 }
53 #endif
54 #else /*!HAVE_READLINE*/
55 int main(int argc, char *argv[])
56 {
57  return 0;
58 }
59 #endif
60 
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
void system(sys)
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
Function definitions for using python to do machine learning in Singular.
#define strdup
Definition: omAllocFunc.c:18
int main(int argc, char *argv[])
HAVE_READLINE.
Definition: test_bufsize.c:55