source: git/factory/test.cc @ 43bbd6

fieker-DuValspielwiese
Last change on this file since 43bbd6 was 72486f0, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
fix test program in factory (uses omalloc & findexec + misc + reporter + resources) FIX: 'make check' has to link against (and thus needs) resources, reporter, misc, findexec, omalloc! FIX: factory test programs must supply the binary' path and initialize Resources... CHG: search and open "gftables/%d" instead of just "%d" while loading %d^th gftable (search pathes updated accordingly) NOTE: This change makes it impossible to check factory without building polys first :( This should be resolved by separating libresources (+???) into another library (possibly including findexec)...
  • Property mode set to 100644
File size: 2.1 KB
Line 
1#include <factory/factory.h>
2
3int mmInit(void) {return 1; }
4
5int test2 (int p)
6{
7  setCharacteristic (p);
8  CanonicalForm d1= Variable (1) + Variable (2) + 1;
9  CanonicalForm f1= Variable (1) - Variable (2) - 2;
10  CanonicalForm g1= Variable (1) + Variable (2) + 2;
11  CanonicalForm d= power (d1, 2);
12  CanonicalForm f= d* power (f1, 2);
13  CanonicalForm g= d* power (g1, 2);
14  CanonicalForm h= gcd (f,g);
15  h /= Lc (h);
16  if (h != d)
17    return -1;
18  printf ("h==d? %d\n", (h == d));
19  for (int i= 3; i <= 11; i++)
20  {
21    d1 += power (Variable (i), i);
22    f1 -= power (Variable (i), i);
23    g1 += power (Variable (i), i);
24    d= power (d1, 2);
25    f= d*power (f1, 2);
26    g= d*power (g1, 2);
27    h= gcd (f,g);
28    h /= Lc (h);
29    if (h != d)
30      return -1;
31    printf ("h==d? %d\n", (h == d));
32  }
33  return 1;
34}
35
36/*int test5 (int p)
37{
38  setCharacteristic (p);
39  Variable x= Variable (1);
40  CanonicalForm d1= x + 1;
41  CanonicalForm d2= Variable (2) + 1;
42  CanonicalForm f1= x - 2;
43  CanonicalForm f2= Variable (2) - 2;
44  CanonicalForm g1= x + 2;
45  CanonicalForm g2= Variable (2) + 2;
46  CanonicalForm d= d1*d2 - 2;
47  CanonicalForm f= f1*f2 + 2;
48  CanonicalForm g= g1*g2 - 2;
49  f *= d;
50  g *= d;
51  CanonicalForm h= gcd (f, g);
52  h /= Lc (h);
53  if (h != d)
54    return - 1;
55  printf ("h==d? %d\n", (h == d));
56  for (int i= 3; i <= 11; i++)
57  {
58    d2 *= power (Variable (i), i) + 1;
59    f2 *= power (Variable (i), i) - 2;
60    g2 *= power (Variable (i), i) + 2;
61
62    d= d1*d2 - 2;
63    f= f1*f2 + 2;
64    g= g1*g2 - 2;
65    f *= d;
66    g *= d;
67    h= gcd (f, g);
68    h /= Lc (h);
69    if (h != d)
70      return -1;
71    printf ("h==d? %d\n", (h == d));
72  }
73  return 1;
74}*/
75
76extern void feInitResources(const char* argv0 = NULL);
77
78int main( int, char *argv[] )
79{
80  feInitResources(argv[0]);
81   
82  int t= test2 (0);
83  if (t < 0)
84    return t;
85  /*t= test5 (0);
86  if (t < 0)
87    return t;
88  t= test5 (3);
89  if (t < 0)
90    return t;
91  t= test5 (101);
92  if (t < 0)
93    return t;
94  t= test5 (43051);
95  if (t < 0)
96    return t;*/
97  t= test2 (3);
98  if (t < 0)
99    return t;
100  t= test2 (101);
101  if (t < 0)
102    return t;
103  t= test2 (43051);
104  if (t < 0)
105    return t;
106  return 0;
107}
Note: See TracBrowser for help on using the repository browser.