]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
more tests for Smartpointer
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 5 Feb 1999 19:57:40 +0000 (19:57 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 5 Feb 1999 19:57:40 +0000 (19:57 +0000)
git-svn-id: https://svn.dealii.org/trunk@766 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/.cvsignore [new file with mode: 0644]
tests/base/Makefile
tests/base/reference.cc

diff --git a/tests/base/.cvsignore b/tests/base/.cvsignore
new file mode 100644 (file)
index 0000000..edba865
--- /dev/null
@@ -0,0 +1 @@
+*.go reference logtest tensor
index 2bc758d93e78a44a22d5ee77bc2760ab22a522a2..a3aad1aeae392345c0fdf8117020d6e0d014013a 100644 (file)
@@ -5,14 +5,7 @@
 
 D=../..
 
-CXX       = c++
-INCLUDE   = -I$D/deal.II/include -I$D/lac/include \
-            -I$D/base/include
-
-CXXFLAGS  = -DDEBUG -g -Wall -W -pedantic -Wconversion \
-            -Winline -Woverloaded-virtual  \
-            $(INCLUDE) -Ddeal_II_dimension=$(deal_II_dimension)
-
+include $D/deal.II/Make.global_options
 
 %.go : %.cc
        @echo ============================ Compiling with debugging information:   $<
@@ -26,11 +19,6 @@ vpath %.a: $D/base/lib
 vpath %.a: $D/lac/lib
 vpath %.a: $D/deal.II/lib
 
-ifeq ($(shell uname),Linux)
-CXX       = /home/wolf/bin/gcc/bin/c++
-endif
-
-
 test: run-reference run-logtest run-tensor
 
 
@@ -38,19 +26,19 @@ reference: reference.go
        $(CXX) $(CXXFLAGS) -o $@ $^ $D/base/lib/libbase.g.a
 
 run-reference: reference
-       ./reference
+       -./reference
 
 logtest: logtest.go
        $(CXX) $(CXXFLAGS) -o $@ $^ $D/base/lib/libbase.g.a
 
 run-logtest: logtest
-       ./logtest
+       -./logtest
 
 tensor: tensor.go
        $(CXX) $(CXXFLAGS) -o $@ $^ $D/base/lib/libbase.g.a
 
 run-tensor: tensor
-       ./tensor
+       -./tensor
 
 
 clean:
index e98fda917cbc59605e21638af8e627213e4fa9e8..1ba549345e7fd809267c5bec083b6c4d349042d9 100644 (file)
@@ -6,7 +6,17 @@
 
 class Test : public Subscriptor
 {
+  const char* name;
 public:
+  Test(const char* n) :
+                 name(n)
+      {
+       cout << "Construct " << name << endl;
+      }
+  ~Test()
+      {
+       cout << "Destruct " << name << endl;
+      }          
   void f()
   {
     cout << "mutable" << endl;
@@ -21,20 +31,37 @@ public:
 
 main()
 {
-  Test a;
-  const Test b;
+  Test a("A");
+  const Test b("B");
   SmartPointer<Test>       r=&a;
   SmartPointer<const Test> s=&a;
 //  SmartPointer<Test>       t=&b;    // this one should not work
   SmartPointer<Test>       t=const_cast<Test*>(&b);
   SmartPointer<const Test> u=&b;
 
+  
+  cout << "a ";
   a.f();            // should print "mutable", since #a# is not const
+  cout << "b ";
   b.f();            // should print "const", since #b# is const
+  cout << "r ";
   r->f();           // should print "mutable", since it points to the non-const #a#
-  s->f();           // should print "const", since it points to the non-const #a#
+  cout << "s ";
+  s->f();           // should print "const", since it points to the const #b#
                                   // but we made it const
+  cout << "t ";
   t->f();           // should print "mutable", since #b# is const, but
                                   // we casted the constness away
+  cout << "u ";
   u->f();           // should print "const" since #b# is const
+                                  // Now try if subscriptor works
+  {
+    Test c("C");
+    r = &c;
+    Test d("D");
+    r = &d;
+  }
 }
+
+void abort()
+{}

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.