diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2012-10-02 17:52:42 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2012-10-02 17:52:42 +0000 |
commit | bc81132e7639d7efe644d530b86f9ea413547e6e (patch) | |
tree | b543a01642b2409f7efd0bdcbbfbefcbcbf7ff1a | |
parent | 40e246fa6f54a84618e403e9c3c34ed720e80a96 (diff) | |
download | ATCD-bc81132e7639d7efe644d530b86f9ea413547e6e.tar.gz |
Tue Oct 2 17:50:55 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl>
* connectors/dds4ccm/impl/ndds/convertors/StringSeq.h:
* connectors/dds4ccm/tests/Policies/main.cpp:
* connectors/dds4ccm/tests/Policies/policies.mpc:
* connectors/dds4ccm/tests/Policies/string_seq.h:
* connectors/dds4ccm/tests/Policies/string_seq.cpp:
Test StringSeq conversion and fixed a bug in the conversion
from a tao sequence to a RTI sequence
-rw-r--r-- | CIAO/ChangeLog | 10 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/impl/ndds/convertors/StringSeq.h | 1 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/tests/Policies/main.cpp | 16 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/tests/Policies/policies.mpc | 1 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/tests/Policies/string_seq.cpp | 34 | ||||
-rw-r--r-- | CIAO/connectors/dds4ccm/tests/Policies/string_seq.h | 20 |
6 files changed, 82 insertions, 0 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 39a6b296c9a..922efebf267 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,13 @@ +Tue Oct 2 17:50:55 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> + + * connectors/dds4ccm/impl/ndds/convertors/StringSeq.h: + * connectors/dds4ccm/tests/Policies/main.cpp: + * connectors/dds4ccm/tests/Policies/policies.mpc: + * connectors/dds4ccm/tests/Policies/string_seq.h: + * connectors/dds4ccm/tests/Policies/string_seq.cpp: + Test StringSeq conversion and fixed a bug in the conversion + from a tao sequence to a RTI sequence + Tue Oct 2 17:29:33 UTC 2012 Johnny Willemsen <jwillemsen@remedy.nl> * connectors/dds4ccm/impl/ndds/DataReader_T.cpp: diff --git a/CIAO/connectors/dds4ccm/impl/ndds/convertors/StringSeq.h b/CIAO/connectors/dds4ccm/impl/ndds/convertors/StringSeq.h index 6a7b04627dd..9becee42564 100644 --- a/CIAO/connectors/dds4ccm/impl/ndds/convertors/StringSeq.h +++ b/CIAO/connectors/dds4ccm/impl/ndds/convertors/StringSeq.h @@ -30,6 +30,7 @@ operator<<= (::DDS_StringSeq & dds_string_seq, const ::DDS::StringSeq & string_s { parameterlist[i] = string_seq[i].in (); } + dds_string_seq.maximum(string_seq.length ()); dds_string_seq.length (string_seq.length ()); dds_string_seq.from_array (parameterlist, string_seq.length ()); delete [] parameterlist; diff --git a/CIAO/connectors/dds4ccm/tests/Policies/main.cpp b/CIAO/connectors/dds4ccm/tests/Policies/main.cpp index 22896b0ecb9..a2d9fdb03d9 100644 --- a/CIAO/connectors/dds4ccm/tests/Policies/main.cpp +++ b/CIAO/connectors/dds4ccm/tests/Policies/main.cpp @@ -10,6 +10,7 @@ #include "tp_qos_test.h" #include "dp_qos_test.h" #include "states_test.h" +#include "string_seq.h" int handle_result (const int & result, const char * test) @@ -38,6 +39,20 @@ int handle_result (const int & result, return ret; } +bool +test_string_seq () +{ + DDS::StringSeq foo (2); + foo.length (2); + foo[0] = CORBA::string_dup ("bar"); + foo[1] = CORBA::string_dup ("foo"); + DDS_StringSeq rti_foo; + rti_foo <<= foo; + DDS::StringSeq tao_foo; + tao_foo <<= rti_foo; + return StringSequence::check (rti_foo, tao_foo, "StringSeq"); +} + int ACE_TMAIN (int , ACE_TCHAR **) { @@ -67,6 +82,7 @@ ACE_TMAIN (int , ACE_TCHAR **) ret += handle_result (test, "DomainParticipant"); test = states.run (); ret += handle_result (test, "States"); + ret += test_string_seq (); } catch (...) { diff --git a/CIAO/connectors/dds4ccm/tests/Policies/policies.mpc b/CIAO/connectors/dds4ccm/tests/Policies/policies.mpc index 7ecd0981d78..b8379b62099 100644 --- a/CIAO/connectors/dds4ccm/tests/Policies/policies.mpc +++ b/CIAO/connectors/dds4ccm/tests/Policies/policies.mpc @@ -38,6 +38,7 @@ project(DDS_Policies_Test) : taoexe, typecode, dds4ccm_base { wr_lifecycle_qos_test.cpp duration.cpp octet_seq.cpp + string_seq.cpp states_test.cpp } diff --git a/CIAO/connectors/dds4ccm/tests/Policies/string_seq.cpp b/CIAO/connectors/dds4ccm/tests/Policies/string_seq.cpp new file mode 100644 index 00000000000..ed5a339f3e3 --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/Policies/string_seq.cpp @@ -0,0 +1,34 @@ +//$Id$ + +#include "string_seq.h" + +StringSequence::StringSequence () +{ +} + +bool +StringSequence::check (const ::DDS_StringSeq & dds_seq, + const ::DDS::StringSeq & seq, + const char * test) +{ + if (static_cast < ::CORBA::ULong> (dds_seq.length ()) != + seq.length ()) + { + ACE_ERROR ((LM_ERROR, "ERROR %C : " + "Length group_data is not equal to original length.\n", + test)); + return false; + } + + for (::DDS_Long i = 0; i < dds_seq.length (); ++i) + { + if (ACE_OS::strcmp (seq[i], dds_seq[i]) != 0) + { + ACE_ERROR ((LM_ERROR, "ERROR %C : " + "Item %d of group_data is not equal to original <%C>:<%C>.\n", + test, i, seq[i].in (), dds_seq[i])); + return false; + } + } + return true; +} diff --git a/CIAO/connectors/dds4ccm/tests/Policies/string_seq.h b/CIAO/connectors/dds4ccm/tests/Policies/string_seq.h new file mode 100644 index 00000000000..84840d8753d --- /dev/null +++ b/CIAO/connectors/dds4ccm/tests/Policies/string_seq.h @@ -0,0 +1,20 @@ +//$Id$ + +#ifndef STRING_SEQ_H_ +#define STRING_SEQ_H_ + +#include "dds4ccm/idl/dds_rtf2_dcpsC.h" +#include "ndds/ndds_cpp.h" +#include "dds4ccm/impl/ndds/convertors/StringSeq.h" + +class StringSequence +{ +public: + StringSequence (); + + static bool check (const ::DDS_StringSeq & dds_seq, + const ::DDS::StringSeq & seq, + const char * test); +}; + +#endif /* STRING_SEQ_H_ */ |