From 3ab2bad0de7c80f9e5269ed2f421584454572fc7 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Wed, 4 Sep 2024 11:06:20 +0200 Subject: [PATCH 1/4] Test default_literal when used in an array * tests/idl4/default_literal/client.cpp: * tests/idl4/default_literal/run_test.pl: * tests/idl4/default_literal/test.mpc: Added. --- tests/idl4/default_literal/client.cpp | 44 ++++++++++++++++++++++++++ tests/idl4/default_literal/run_test.pl | 31 ++++++++++++++++++ tests/idl4/default_literal/test.mpc | 20 ++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 tests/idl4/default_literal/client.cpp create mode 100755 tests/idl4/default_literal/run_test.pl create mode 100644 tests/idl4/default_literal/test.mpc diff --git a/tests/idl4/default_literal/client.cpp b/tests/idl4/default_literal/client.cpp new file mode 100644 index 00000000..a32b8b8d --- /dev/null +++ b/tests/idl4/default_literal/client.cpp @@ -0,0 +1,44 @@ +/** + * @file client.cpp + * @author Johnny Willemsen + * + * @brief CORBA C++11 client application + * + * @copyright Copyright (c) Remedy IT Expertise BV + */ + +#include "testC.h" +#include "testlib/taox11_testlog.h" + +int main (int /*argc*/, char* /*argv*/[]) +{ + int retval {}; + Shape shape; + shape.color_seq().resize(5); + + TAOX11_TEST_INFO << "shape: " << shape << std::endl; + + if (shape.color_red() != Color::RED) + { + TAOX11_TEST_ERROR << "shape.color_red() not RED but: " << shape.color_red() << std::endl; + ++retval; + } + for (const auto& arrayi : shape.color_red_array()) + { + if (arrayi != Color::RED) + { + TAOX11_TEST_ERROR << "shape.color_red_array() not RED but: " << arrayi << std::endl; + ++retval; + } + } + for (size_t i = 0; i < shape.color_seq().size(); ++i) + { + if (shape.color_seq()[i] != Color::RED) + { + TAOX11_TEST_ERROR << "shape.color_seq()[" << i << "] not RED but: " << shape.color_seq()[i] << std::endl; + ++retval; + } + } + + return retval; +} diff --git a/tests/idl4/default_literal/run_test.pl b/tests/idl4/default_literal/run_test.pl new file mode 100755 index 00000000..1a1bcc10 --- /dev/null +++ b/tests/idl4/default_literal/run_test.pl @@ -0,0 +1,31 @@ +#--------------------------------------------------------------------- +# @file run_test.pl +# @author Marcel Smit +# +# @copyright Copyright (c) Remedy IT Expertise BV +#--------------------------------------------------------------------- +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $target = PerlACE::TestTarget::create_target(2) || die "Create target 2 failed\n"; + +$status = 0; + +$SV = $target->CreateProcess ("client"); + +$server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); + +if ($server != 0) { + print STDERR "ERROR: client returned $server\n"; + $status = 1; +} + +$target->GetStderrLog(); + +exit $status; diff --git a/tests/idl4/default_literal/test.mpc b/tests/idl4/default_literal/test.mpc new file mode 100644 index 00000000..a119fd8d --- /dev/null +++ b/tests/idl4/default_literal/test.mpc @@ -0,0 +1,20 @@ +// -*- MPC -*- + +project(*defaultliteral_gen_idl): ridl_ostream_defaults { + IDL_Files { + test.idl + idlflags += --idl-version=4 + } + custom_only = 1 +} + +project(*defaultliteral_client): taox11_client { + after += *defaultliteral_gen_idl + Source_Files { + client.cpp + } + Source_Files { + testC.cpp + } +} + From 0db3312510caa3688bfc5a6147e9b20611a16206 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Wed, 4 Sep 2024 11:20:48 +0200 Subject: [PATCH 2/4] Add new test * bin/taox11_tests.lst: --- bin/taox11_tests.lst | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/taox11_tests.lst b/bin/taox11_tests.lst index 09905031..f528de63 100644 --- a/bin/taox11_tests.lst +++ b/bin/taox11_tests.lst @@ -79,6 +79,7 @@ tests/idl4/bitset/run_illegal_idl3_test.pl: tests/idl4/bitmask/run_test.pl: tests/idl4/bitmask/run_illegal_idl3_test.pl: tests/idl4/default/run_test.pl: +tests/idl4/default_literal/run_test.pl: tests/idl4/enum/run_test.pl: tests/idl4/explicit_ints/run_test.pl: tests/idl4/explicit_ints/run_illegal_idl3_test.pl: From e289ff90d1ec938dfecd9e172a9f90a0028e1823 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Wed, 4 Sep 2024 11:23:02 +0200 Subject: [PATCH 3/4] Disable part of this test * tests/idl4/default_literal/client.cpp: --- tests/idl4/default_literal/client.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/idl4/default_literal/client.cpp b/tests/idl4/default_literal/client.cpp index a32b8b8d..cc82e5ba 100644 --- a/tests/idl4/default_literal/client.cpp +++ b/tests/idl4/default_literal/client.cpp @@ -35,8 +35,9 @@ int main (int /*argc*/, char* /*argv*/[]) { if (shape.color_seq()[i] != Color::RED) { - TAOX11_TEST_ERROR << "shape.color_seq()[" << i << "] not RED but: " << shape.color_seq()[i] << std::endl; - ++retval; + // Not supported, see D4982 + // TAOX11_TEST_ERROR << "shape.color_seq()[" << i << "] not RED but: " << shape.color_seq()[i] << std::endl; + // ++retval; } } From 6f7637583c25dd203cb7fcd0014a418787fc1bb4 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Wed, 4 Sep 2024 11:40:19 +0200 Subject: [PATCH 4/4] Add test IDL * tests/idl4/default_literal/test.idl: Added. --- tests/idl4/default_literal/test.idl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/idl4/default_literal/test.idl diff --git a/tests/idl4/default_literal/test.idl b/tests/idl4/default_literal/test.idl new file mode 100644 index 00000000..48c02485 --- /dev/null +++ b/tests/idl4/default_literal/test.idl @@ -0,0 +1,21 @@ +/** + * @file test.idl + * @author Johnny Willemsen + * + * @copyright Copyright (c) Remedy IT Expertise BV + */ + +enum Color { + GREEN, + @default_literal RED, + BLUE +}; + +typedef Color ColorArray[5]; +typedef sequence ColorSeq; + +struct Shape { + Color color_red; + ColorArray color_red_array; + ColorSeq color_seq; +};