source: git/Singular/Wrappers.cc @ 2b78bd

spielwiese
Last change on this file since 2b78bd was 2b78bd, checked in by Frank Seelisch <seelisch@…>, 15 years ago
test code for Minors and C++Wrappers (with defines HAVE_MINOR and HAVE_WRAPPERS) git-svn-id: file:///usr/local/Singular/svn/trunk@12151 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.0 KB
Line 
1#include "mod2.h"
2
3#ifdef HAVE_WRAPPERS
4
5#include <iostream>
6#include "RingWrapper.h"
7#include "PolyWrapper.h"
8#include "Wrappers.h"
9#include "febase.h"
10
11void test1 ();
12void test2 ();
13void test3 ();
14
15PrettyPrinter prpr("", "", false, false, -1, "   ");
16
17void testWrappers (bool detailedOutput)
18{
19  prpr.setConsole(detailedOutput ? 0 : -1);
20  prpr+1;
21
22  test1();
23  test2();
24  test3();
25
26  prpr-1;
27  PrintLn();
28  PrintLn();
29}
30
31void test1 ()
32{
33  PrintLn();
34  PrintS("Test1: Creation and destruction of instances of RingWrapper");
35  const char* theVariables1[2] = {"x", "y"};
36  RingWrapper r1("myRing1", 7, 2, theVariables1, "dp");
37  PrintLn(); PrintS("r1 = "); r1.print();
38  const char* theVariables2[3] = {"u", "v", "w"};
39  RingWrapper r2("myRing2", 0, 3, theVariables2, "Ds");
40  PrintLn(); PrintS("r2 = "); r2.print();
41}
42
43void test2 ()
44{
45  PrintLn();
46  PrintS("Test2: Creation, copying, assignment, and destruction of instances of PolyWrapper");
47  const char* theVariables[2] = {"x", "y"};
48  RingWrapper r("myRing", 0, 2, theVariables, "lp");
49  PrintLn(); PrintS("r = "); r.print();
50  PolyWrapper p1(4, r);
51  PrintLn(); PrintS("p1 = "); p1.print();
52  PolyWrapper p2(p1);
53  PrintLn(); PrintS("p2 = "); p2.print();
54  PolyWrapper p3(-37, r);
55  PrintLn(); PrintS("p3 = "); p3.print();
56  PolyWrapper p4(p3);
57  PrintLn(); PrintS("p4 = "); p4.print();
58  PolyWrapper p5 = p2;
59  PrintLn(); PrintS("p5 = "); p5.print();
60}
61
62void test3 ()
63{
64  PrintLn();
65  PrintS("Test3: Addition of instances of PolyWrapper");
66  const char* theVariables[2] = {"x", "y"};
67  RingWrapper r("myRing", 0, 2, theVariables, "Ds");
68  PrintLn(); PrintS("r = "); r.print();
69  PolyWrapper p1(4, r);
70  PrintLn(); PrintS("p1 = "); p1.print();
71  PolyWrapper p2(7, r);
72  PrintLn(); PrintS("p2 = "); p2.print();
73  PolyWrapper p3 = p1 + p2;
74  PrintLn(); PrintS("p3 = "); p3.print();
75  p3 = p1;
76  PrintLn(); PrintS("p3 = "); p3.print();
77  p3 += p2;  // this should change p3 but NOT p2!
78  PrintLn(); PrintS("p3 = "); p3.print();
79  PrintLn(); PrintS("p2 = "); p2.print();
80}
81
82#endif // HAVE_WRAPPERS
Note: See TracBrowser for help on using the repository browser.