Skip to content

Commit

Permalink
Merge pull request #324 from jwillemsen/jwi-defaultannotation
Browse files Browse the repository at this point in the history
First test for default annotation (not supported yet)
  • Loading branch information
jwillemsen authored Sep 1, 2023
2 parents 1a652a0 + 5e72698 commit d8ef436
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 2 deletions.
48 changes: 48 additions & 0 deletions tests/idl4/default/client.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @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 {};
bar mybar;

// Just compilation test
TAOX11_TEST_INFO << "mybar: " << mybar << std::endl;

if (mybar.short_no_default() != 0)
{
TAOX11_TEST_ERROR << "mybar.short_no_default() not 0 but: " << mybar.short_no_default() << std::endl;
++retval;
}
if (mybar.short_5() != 5)
{
TAOX11_TEST_ERROR << "mybar.short_5() not 5 but: " << mybar.short_5() << std::endl;
++retval;
}
if (mybar.short_8() != 8)
{
TAOX11_TEST_ERROR << "mybar.short_8() not 8 but: " << mybar.short_8() << std::endl;
++retval;
}
if (mybar.typedef_short_8() != 8)
{
TAOX11_TEST_ERROR << "mybar.typedef_short_8() not 8 but: " << mybar.typedef_short_8() << std::endl;
++retval;
}
if (mybar.typedef_short_9() != 9)
{
TAOX11_TEST_ERROR << "mybar.typedef_short_9() not 9 but: " << mybar.typedef_short_9() << std::endl;
++retval;
}

return retval;
}
31 changes: 31 additions & 0 deletions tests/idl4/default/run_test.pl
Original file line number Diff line number Diff line change
@@ -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: const returned $server\n";
$status = 1;
}

$target->GetStderrLog();

exit $status;
19 changes: 19 additions & 0 deletions tests/idl4/default/test.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @file test.idl
* @author Johnny Willemsen
*
* @copyright Copyright (c) Remedy IT Expertise BV
*/

@default(8) typedef short short_type_8;
typedef short_type_8 typedef_short_type_8;

struct bar
{
short short_no_default;
@default(5) short short_5;
short_type_8 short_8;
typedef_short_type_8 typedef_short_8;
@default(9) typedef_short_type_8 typedef_short_9;
};

20 changes: 20 additions & 0 deletions tests/idl4/default/test.mpc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// -*- MPC -*-

project(*default_gen_idl): ridl_ostream_defaults {
IDL_Files {
test.idl
idlflags += --idl-version=4
}
custom_only = 1
}

project(*default_client): taox11_client {
after += *default_gen_idl
Source_Files {
client.cpp
}
Source_Files {
testC.cpp
}
}

12 changes: 10 additions & 2 deletions tests/idl4/enum/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,43 +14,51 @@
int main (int /*argc*/, char* /*argv*/[])
{
// Just compilation test

int retval {};
MyEnum my_bitenum;
X11_UNUSED_ARG(my_bitenum);

if (sizeof(uint8_t) != sizeof(MyEnumBound8))
{
++retval;
TAOX11_TEST_ERROR << "Type of MyEnumBound8 is not uint8_t" << std::endl;
}
if (sizeof(uint16_t) != sizeof (MyEnumBound16))
{
++retval;
TAOX11_TEST_ERROR << "Type of MyEnumBound16 is not uint16_t" << std::endl;
}
if (sizeof(uint32_t) != sizeof (MyEnumBound32))
{
++retval;
TAOX11_TEST_ERROR << "Type of MyEnumBound32 is not uint32_t" << std::endl;
}
if (sizeof(uint32_t) != sizeof (MyEnum))
{
++retval;
TAOX11_TEST_ERROR << "Type of MyEnum is not uint32_t" << std::endl;
}

if (IDL::traits<MyEnumBound8>::bit_bound::value != 8)
{
++retval;
TAOX11_TEST_ERROR << "bit_bound traits MyEnumBound8 is 8" << std::endl;
}
if (IDL::traits<MyEnumBound16>::bit_bound::value != 16)
{
++retval;
TAOX11_TEST_ERROR << "bit_bound traits MyEnumBound16 is 16" << std::endl;
}
if (IDL::traits<MyEnumBound32>::bit_bound::value != 32)
{
++retval;
TAOX11_TEST_ERROR << "bit_bound traits MyEnumBound32 is 32" << std::endl;
}
if (IDL::traits<MyEnum>::bit_bound::value != 32)
{
++retval;
TAOX11_TEST_ERROR << "bit_bound traits MyEnum is 32" << std::endl;
}

return 0;
return retval;
}

0 comments on commit d8ef436

Please sign in to comment.