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: diff --git a/tests/idl4/default_literal/client.cpp b/tests/idl4/default_literal/client.cpp new file mode 100644 index 00000000..cc82e5ba --- /dev/null +++ b/tests/idl4/default_literal/client.cpp @@ -0,0 +1,45 @@ +/** + * @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) + { + // Not supported, see D4982 + // 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.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; +}; 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 + } +} +