diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-03-21 01:47:50 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-03-21 01:47:50 +0000 |
commit | 3780285be6195aef4ca526e1a7f88b7cdd8edec3 (patch) | |
tree | c39a5eb36d5863de1b043f9eafb94fd076fa549d /TAO/tests/CDR/basic_types.cpp | |
parent | d79706b30ce5e66aea5effc0306f77975cb31032 (diff) | |
download | ATCD-ACE-4_4_34.tar.gz |
This commit was manufactured by cvs2svn to create tag 'ACE-4_4_34'.ACE-4_4_34
Diffstat (limited to 'TAO/tests/CDR/basic_types.cpp')
-rw-r--r-- | TAO/tests/CDR/basic_types.cpp | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/TAO/tests/CDR/basic_types.cpp b/TAO/tests/CDR/basic_types.cpp deleted file mode 100644 index 51e18df7461..00000000000 --- a/TAO/tests/CDR/basic_types.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// TAO/tests/CDR -// -// = FILENAME -// basic_types.cpp -// -// = DESCRIPTION -// Test the basic funcionality of a CDR stream by encoding some -// basic types and then decoding them again. -// -// = AUTHORS -// Carlos O'Ryan -// -// ============================================================================ - -#include "tao/corba.h" - -static const int n = 4096; - -struct CDR_Test_Types -{ - CDR_Test_Types (void): - o (1), s (2), l (4) {} - - CORBA::Octet o; - CORBA::Short s; - CORBA::Long l; -}; - -static int -test_put (CDR &cdr, CDR_Test_Types &test_types) -{ - for (int i = 0; i < n; ++i) - { - if (cdr.put_octet (test_types.o) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "put_octet[%d] failed\n", - i), - 1); - if (cdr.put_short (test_types.s) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "put_short[%d] failed\n", - i), - 1); - if (cdr.put_octet (test_types.o) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "put_octet-2[%d] failed\n", - i), - 1); - if (cdr.put_long (test_types.l) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "put_long[%d] failed\n", - i), - 1); - if (cdr.put_long (test_types.l) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "put_long-2[%d] failed\n", - i), - 1); - } - - return 0; -} - -static int -test_get (CDR &cdr, const CDR_Test_Types &test_types) -{ - CORBA::Octet xo; - CORBA::Short xs; - CORBA::Long xl; - - for (int i = 0; i < n; ++i) - { - if (cdr.get_octet (xo) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "get_octet[%d] failed\n", - i), - 1); - if (xo != test_types.o) - ACE_ERROR_RETURN ((LM_ERROR, - "octet[%d] differs\n", - i), - 1); - if (cdr.get_short (xs) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "get_short[%d] failed\n", - i), 1); - if (xs != test_types.s) - ACE_ERROR_RETURN ((LM_ERROR, - "short[%d] differs\n", - i), - 1); - if (cdr.get_octet (xo) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "get_octet-2[%d] failed\n", - i), - 1); - if (xo != test_types.o) - ACE_ERROR_RETURN ((LM_ERROR, - "octet-2[%d] differs\n", - i), - 1); - if (cdr.get_long (xl) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "get_long[%d] failed\n", - i), - 1); - if (xl != test_types.l) - ACE_ERROR_RETURN ((LM_ERROR, - "long[%d] differs\n", - i), - 1); - if (cdr.get_long (xl) == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "get_long-2[%d] failed\n", - i), - 1); - if (xl != test_types.l) - ACE_ERROR_RETURN ((LM_ERROR, - "long-2[%d] differs\n", - i), - 1); - } - - return 0; -} - -int -main (int, char *[]) -{ - CDR cdr; - CDR_Test_Types test_types; - - if (test_put (cdr, test_types) == 0 - && test_get (cdr, test_types) == 0) - return 0; - else - return 1; -} |