diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-03-19 02:39:15 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-03-19 02:39:15 +0000 |
commit | e5fc98b189a0afcf86acf196782890bbd3c2ad5b (patch) | |
tree | 24f8ff2046db0024fb593066c101a6548d3a1de5 | |
parent | 1c877a26f48a2dbbd0886bc2c39735e07ed7025a (diff) | |
download | ATCD-e5fc98b189a0afcf86acf196782890bbd3c2ad5b.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/tests/CDR/basic_types.cpp | 168 | ||||
-rw-r--r-- | TAO/tests/CDR/tc.cpp | 36 |
2 files changed, 124 insertions, 80 deletions
diff --git a/TAO/tests/CDR/basic_types.cpp b/TAO/tests/CDR/basic_types.cpp index 759249b7cbf..77a060a2497 100644 --- a/TAO/tests/CDR/basic_types.cpp +++ b/TAO/tests/CDR/basic_types.cpp @@ -1,90 +1,126 @@ -// // $Id$ -// #include "tao/corba.h" -int -main (int , char *[]) +static const int n = 4096; + +struct CDR_Test_Types { - CDR cdr; + CDR_Test_Types (void): + o (1), s (2), l (4) {} - CORBA::Octet o = 1; - CORBA::Short s = 2; - CORBA::Long l = 4; + CORBA::Octet o; + CORBA::Short s; + CORBA::Long l; +}; - const int n = 4096; +static int +test_put (CDR &cdr, CDR_Test_Types &test_types) +{ for (int i = 0; i < n; ++i) { - if (cdr.put_octet (o) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "put_octet[%d] failed\n", i), 1); - } - if (cdr.put_short (s) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "put_short[%d] failed\n", i), 1); - } - if (cdr.put_octet (o) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "put_octet-2[%d] failed\n", i), 1); - } - if (cdr.put_long (l) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "put_long[%d] failed\n", i), 1); - } - if (cdr.put_long (l) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "put_long-2[%d] failed\n", i), 1); - } + 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; + CORBA::Long xl; - for (int j = 0; j < n; ++j) + for (int i = 0; i < n; ++i) { if (cdr.get_octet (xo) == 0) - { - ACE_ERROR_RETURN ((LM_ERROR, "get_octet[%d] failed\n", j), 1); - } - if (xo != o) - { - ACE_ERROR_RETURN ((LM_ERROR, "octet[%d] differs\n", j), 1); - } + 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", j), 1); - } - if (xs != s) - { - ACE_ERROR_RETURN ((LM_ERROR, "short[%d] differs\n", j), 1); - } + 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", j), 1); - } - if (xo != o) - { - ACE_ERROR_RETURN ((LM_ERROR, "octet-2[%d] differs\n", j), 1); - } + 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", j), 1); - } - if (xl != l) - { - ACE_ERROR_RETURN ((LM_ERROR, "long[%d] differs\n", j), 1); - } + 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", j), 1); - } - if (xl != l) - { - ACE_ERROR_RETURN ((LM_ERROR, "long-2[%d] differs\n", j), 1); - } + 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; +} diff --git a/TAO/tests/CDR/tc.cpp b/TAO/tests/CDR/tc.cpp index 6461e173f2f..e90d2933d1d 100644 --- a/TAO/tests/CDR/tc.cpp +++ b/TAO/tests/CDR/tc.cpp @@ -1,13 +1,12 @@ -// // $Id$ -// #include "tao/corba.h" // In this version of TAO typecodes are based on CDR, we have to // verify that CDR offers the services needed for Typecode... -static CORBA::TypeCode_ptr tcs[]= { +static CORBA::TypeCode_ptr tcs[]= +{ CORBA::_tc_null, CORBA::_tc_void, CORBA::_tc_short, @@ -65,6 +64,7 @@ static CORBA::TypeCode_ptr tcs[]= { CORBA::_tc_Bounds, CORBA::_tc_BadKind }; + static int n = sizeof (tcs) / sizeof (tcs[0]); int @@ -72,11 +72,15 @@ main (int argc, char *argv[]) { TAO_TRY { - CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "", + CORBA::ORB_var orb = CORBA::ORB_init (argc, + argv, + 0, TAO_TRY_ENV); TAO_CHECK_ENV; - for (CORBA::TypeCode_ptr* i = tcs; i != tcs + n; ++i) + for (CORBA::TypeCode_ptr *i = tcs; + i != tcs + n; + ++i) { CORBA::TypeCode_ptr tc = *i; @@ -92,13 +96,14 @@ main (int argc, char *argv[]) case CORBA::tk_alias: case CORBA::tk_except: { - const char* id = tc->id (TAO_TRY_ENV); + const char *id = tc->id (TAO_TRY_ENV); TAO_CHECK_ENV; - const char* name = tc->name (TAO_TRY_ENV); + const char *name = tc->name (TAO_TRY_ENV); TAO_CHECK_ENV; - CORBA::ULong length = 0; // tc->length (TAO_TRY_ENV); + CORBA::ULong length = 0; + // tc->length (TAO_TRY_ENV); TAO_CHECK_ENV; ACE_DEBUG ((LM_DEBUG, @@ -107,14 +112,17 @@ main (int argc, char *argv[]) " KIND = %d%$" " LENGTH = %d" "%}%}\n", - id, name, k, length)); + id, + name, + k, + length)); + break; } - break; default: - { - ACE_DEBUG ((LM_DEBUG, "basic type: %d\n", k)); - } - break; + ACE_DEBUG ((LM_DEBUG, + "basic type: %d\n", + k)); + break; } } } |