toon-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Toon-members] TooN TooN.h internal/vbase.hh test/vec_test.cc


From: Edward Rosten
Subject: [Toon-members] TooN TooN.h internal/vbase.hh test/vec_test.cc
Date: Tue, 13 Jan 2009 10:44:45 +0000

CVSROOT:        /cvsroot/toon
Module name:    TooN
Changes by:     Edward Rosten <edrosten>        09/01/13 10:44:45

Modified files:
        .              : TooN.h 
        internal       : vbase.hh 
Added files:
        test           : vec_test.cc 

Log message:
        Basic test program.
        
        Results:
        
        Test OK on line 25
        Test OK on line 31
        Test FAILED on line 37. Expected StaticSliceError, got nothing.
        Test OK on line 46
        Test OK on line 52
        Test FAILED on line 58. Expected SliceError, got nothing.
        Test OK on line 67
        Test OK on line 73
        Test FAILED on line 79. Expected StaticSliceError, got nothing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/TooN/TooN.h?cvsroot=toon&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/TooN/internal/vbase.hh?cvsroot=toon&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/TooN/test/vec_test.cc?cvsroot=toon&rev=1.1

Patches:
Index: TooN.h
===================================================================
RCS file: /cvsroot/toon/TooN/TooN.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- TooN.h      9 Jan 2009 16:23:43 -0000       1.14
+++ TooN.h      13 Jan 2009 10:44:44 -0000      1.15
@@ -20,6 +20,7 @@
        #include <TooN/internal/size_mismatch.hh>
        #include <TooN/internal/slice_error.hh>
        #include <TooN/internal/debug.hh>
+       #include <TooN/internal/vbase.hh>
        #include <TooN/internal/vector.hh>
        #include <TooN/operators.h>
 }

Index: internal/vbase.hh
===================================================================
RCS file: /cvsroot/toon/TooN/internal/vbase.hh,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- internal/vbase.hh   10 Jan 2009 19:46:24 -0000      1.1
+++ internal/vbase.hh   13 Jan 2009 10:44:45 -0000      1.2
@@ -377,7 +377,6 @@
   int my_stride;
 };
 
-
 // traits classes that help with building the vectors you actually
 // construct in code
 static const int MAX_SIZE=10;

Index: test/vec_test.cc
===================================================================
RCS file: test/vec_test.cc
diff -N test/vec_test.cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ test/vec_test.cc    13 Jan 2009 10:44:45 -0000      1.1
@@ -0,0 +1,94 @@
+#define TOON_TEST_INTERNALS
+#include <TooN/TooN.h>
+
+using namespace TooN;
+using namespace std;
+
+int lineno;
+
+#define TRY lineno = __LINE__; try{
+
+#define EXPECT(X) \
+       cerr << "Test FAILED on line " << lineno << ". Expected " << #X << ", 
got nothing." << endl;\
+}\
+catch(TooN::Internal::X e)\
+{\
+    cerr << "Test OK on line " << lineno << endl;\
+}\
+catch(...)\
+{\
+    cerr << "Test FAILED on line " << lineno << ". Expected " << #X << ", got 
unknown error." << endl;\
+}\
+
+void test_bad_static_static_slices()
+{
+       TRY{
+               Vector<2> v;
+               v.slice<0, 3>();
+       }
+       EXPECT(StaticSliceError);
+
+       TRY{
+               Vector<2> v;
+               v.slice<2, 2>();
+       }
+       EXPECT(StaticSliceError);
+
+       TRY{
+               Vector<2> v;
+               v.slice<-1, 1>();
+       }
+       EXPECT(StaticSliceError);
+}
+
+void test_bad_static_dynamic_slices()
+{
+       TRY{
+               Vector<2> v;
+               v.slice(0,3);
+       }
+       EXPECT(SliceError);
+
+       TRY{
+               Vector<2> v;
+               v.slice(2,2);
+       }
+       EXPECT(SliceError);
+
+       TRY{
+               Vector<2> v;
+               v.slice(-1,1);
+       }
+       EXPECT(SliceError);
+}
+
+void test_bad_dynamic_static_slices()
+{
+       TRY{
+               Vector<> v(2);
+               v.slice<0, 3>();
+       }
+       EXPECT(SliceError);
+
+       TRY{
+               Vector<> v(2);
+               v.slice<2, 2>();
+       }
+       EXPECT(SliceError);
+
+       TRY{
+               Vector<> v(2);
+               v.slice<-1, 1>();
+       }
+       EXPECT(StaticSliceError);
+}
+
+
+
+
+int main()
+{
+       test_bad_static_static_slices();
+       test_bad_static_dynamic_slices();
+       test_bad_dynamic_static_slices();
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]