certi-cvs
[Top][All Lists]
Advanced

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

[certi-cvs] certi/libHLA TestHLAtypes.cc


From: certi-cvs
Subject: [certi-cvs] certi/libHLA TestHLAtypes.cc
Date: Fri, 12 Jun 2009 08:29:15 +0000

CVSROOT:        /sources/certi
Module name:    certi
Changes by:     Petr Gotthard <gotthardp>       09/06/12 08:29:15

Modified files:
        libHLA         : TestHLAtypes.cc 

Log message:
        Added test for HLAenumeratedType.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/certi/libHLA/TestHLAtypes.cc?cvsroot=certi&r1=1.3&r2=1.4

Patches:
Index: TestHLAtypes.cc
===================================================================
RCS file: /sources/certi/certi/libHLA/TestHLAtypes.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- TestHLAtypes.cc     18 Nov 2008 17:38:59 -0000      1.3
+++ TestHLAtypes.cc     12 Jun 2009 08:29:15 -0000      1.4
@@ -11,7 +11,7 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 // Lesser General Public License for more details.
 //
-// $Id: TestHLAtypes.cc,v 1.3 2008/11/18 17:38:59 gotthardp Exp $
+// $Id: TestHLAtypes.cc,v 1.4 2009/06/12 08:29:15 gotthardp Exp $
 // ----------------------------------------------------------------------------
 
 #include <memory>
@@ -181,6 +181,36 @@
     }
 }
 
+enum test7_enum {
+    ENUM_0 = 0,
+    ENUM_1 = 1,
+    ENUM_2 = 2
+};
+
+int test7()
+{
+    typedef HLAenumeratedType<test7_enum, HLAoctet> TA;
+
+    HLAdata<TA> A;
+    *A = ENUM_2;
+
+    std::stringstream result;
+    A.print(result);
+
+    const char* correct =
+        "0000:  02\n";
+
+    if(strcmp(result.str().c_str(), correct) != 0) {
+        std::cerr << "test7: <output> does not match expected result" << 
std::endl
+            << result.str() << std::endl << correct << std::endl;
+        return 1;
+    }
+    else {
+        std::cout << result.str();
+        return 0;
+    }
+}
+
 int main(int argc, char* argv[])
 {
     int result = 0;
@@ -197,8 +227,9 @@
     result += test4();
     result += test5();
     result += test6();
+    result += test7();
 
     return result;
 }
 
-// $Id: TestHLAtypes.cc,v 1.3 2008/11/18 17:38:59 gotthardp Exp $
+// $Id: TestHLAtypes.cc,v 1.4 2009/06/12 08:29:15 gotthardp Exp $




reply via email to

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