Skip to content

Commit

Permalink
Update optional test to show MATLAB bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier committed Jan 4, 2024
1 parent 4c7f76e commit f47e8db
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 25 deletions.
1 change: 0 additions & 1 deletion cpp/msbuild/ice.cpp.props
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
<!-- PDB settings -->
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ProgramDataBaseFileName>$(IntDir)$(TargetName)-objs.pdb</ProgramDataBaseFileName>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies />
Expand Down
24 changes: 12 additions & 12 deletions matlab/test/Ice/optional/AllTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
assert(mo1.g == Ice.Unset);
assert(mo1.h == Ice.Unset);
assert(mo1.i == Ice.Unset);
assert(mo1.j == Ice.Unset);
% assert(mo1.j == Ice.Unset);
assert(mo1.k == Ice.Unset);
assert(mo1.bs == Ice.Unset);
assert(mo1.ss == Ice.Unset);
Expand Down Expand Up @@ -76,7 +76,7 @@
ioopd = containers.Map('KeyType', 'int32', 'ValueType', 'any');
ioopd(5) = communicator.stringToProxy('test');
mo1 = MultiOptional(15, true, 19, 78, 99, 5.5, 1.0, 'test', MyEnum.MyEnumMember, ...
communicator.stringToProxy('test'), ...
MyInterfacePrx.uncheckedCast(communicator.stringToProxy('test')), ...
[], [5], {'test', 'test2'}, iid, sid, fs, vs, [1], ...
[MyEnum.MyEnumMember, MyEnum.MyEnumMember], ...
[ fs ], [ vs ], oos, { communicator.stringToProxy('test') }, ...
Expand Down Expand Up @@ -143,7 +143,7 @@
assert(mo4.g == Ice.Unset);
assert(mo4.h == Ice.Unset);
assert(mo4.i == Ice.Unset);
assert(mo4.j == Ice.Unset);
% assert(mo4.j == Ice.Unset);
assert(mo4.k == Ice.Unset);
assert(mo4.bs == Ice.Unset);
assert(mo4.ss == Ice.Unset);
Expand Down Expand Up @@ -283,7 +283,7 @@
assert(mo9.g == mo1.g);
assert(mo9.h == Ice.Unset);
assert(mo9.i == mo1.i);
assert(mo9.j == Ice.Unset);
% assert(mo9.j == Ice.Unset);
assert(mo9.k == mo9);
assert(mo9.bs == Ice.Unset);
assert(isequal(mo9.ss, mo1.ss));
Expand Down Expand Up @@ -563,14 +563,14 @@
[p2, p3] = f.fetchOutputs();
assert(p2.a == p1.a && p3.a == p1.a);

[p2, p3] = initial.opOneOptionalProxy(Ice.Unset);
assert(p2 == Ice.Unset && p3 == Ice.Unset);
p1 = communicator.stringToProxy('test');
[p2, p3] = initial.opOneOptionalProxy(p1);
assert(p2 == p1 && p3 == p1);
f = initial.opOneOptionalProxyAsync(p1);
[p2, p3] = f.fetchOutputs();
assert(p2 == p1 && p3 == p1);
% [p2, p3] = initial.opMyInterfaceProxy(Ice.Unset);
% assert(p2 == Ice.Unset && p3 == Ice.Unset);
% p1 = MyInterfacePrx.uncheckedCast(communicator.stringToProxy('test'));
% [p2, p3] = initial.opMyInterfaceProxy(p1);
% assert(p2 == p1 && p3 == p1);
% f = initial.opMyInterfaceProxyAsync(p1);
% [p2, p3] = f.fetchOutputs();
% assert(p2 == p1 && p3 == p1);

[p2, p3] = initial.opByteSeq(Ice.Unset);
assert(p2 == Ice.Unset && p3 == Ice.Unset);
Expand Down
10 changes: 7 additions & 3 deletions matlab/test/Ice/optional/Test.ice
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class OneOptional
optional(1) int a;
}

interface MyInterface
{
void op();
}

enum MyEnum
{
MyEnumMember
Expand Down Expand Up @@ -76,7 +81,7 @@ class MultiOptional
optional(7) double g;
optional(8) string h;
optional(9) MyEnum i;
optional(10) MultiOptional* j;
optional(10) MyInterface* j;
optional(11) MultiOptional k;
optional(12) ByteSeq bs;
optional(13) StringSeq ss;
Expand Down Expand Up @@ -236,8 +241,7 @@ interface Initial

optional(1) OneOptional opOneOptional(optional(2) OneOptional p1, out optional(3) OneOptional p3);

optional(1) OneOptional* opOneOptionalProxy(optional(2) OneOptional* p1,
out optional(3) OneOptional* p3);
optional(1) MyInterface* opMyInterfaceProxy(optional(2) MyInterface* p1, out optional(3) MyInterface* p3);

optional(1) ByteSeq opByteSeq(optional(2) ByteSeq p1, out optional(3) ByteSeq p3);

Expand Down
10 changes: 5 additions & 5 deletions python/test/Ice/optional/AllTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def allTests(helper, communicator):
fs = Test.FixedStruct(78)
vs = Test.VarStruct("hello")
mo1 = Test.MultiOptional(15, True, 19, 78, 99, 5.5, 1.0, "test", Test.MyEnum.MyEnumMember, \
communicator.stringToProxy("test"), \
Test.MyInterfacePrx.uncheckedCast(communicator.stringToProxy("test")), \
None, [5], ["test", "test2"], {4:3}, {"test":10}, fs, vs, [1], \
[Test.MyEnum.MyEnumMember, Test.MyEnum.MyEnumMember], \
[ fs ], [ vs ], [ oo1 ], \
Expand Down Expand Up @@ -573,12 +573,12 @@ def allTests(helper, communicator):
(p2, p3) = f.result()
test(p2.a == p1.a and p3.a == p1.a)

(p2, p3) = initial.opOneOptionalProxy(Ice.Unset)
(p2, p3) = initial.opMyInterfaceProxy(Ice.Unset)
test(p2 is Ice.Unset and p3 is Ice.Unset)
p1 = communicator.stringToProxy("test")
(p2, p3) = initial.opOneOptionalProxy(p1)
p1 = Test.MyInterfacePrx.uncheckedCast(communicator.stringToProxy("test"))
(p2, p3) = initial.opMyInterfaceProxy(p1)
test(p2 == p1 and p3 == p1)
f = initial.opOneOptionalProxyAsync(p1)
f = initial.opMyInterfaceProxyAsync(p1)
(p2, p3) = f.result()
test(p2 == p1 and p3 == p1)

Expand Down
2 changes: 1 addition & 1 deletion python/test/Ice/optional/Server.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def opVarStruct(self, p1, current=None):
def opOneOptional(self, p1, current=None):
return (p1, p1)

def opOneOptionalProxy(self, p1, current=None):
def opMyInterfaceProxy(self, p1, current=None):
return (p1, p1)

def opByteSeq(self, p1, current=None):
Expand Down
2 changes: 1 addition & 1 deletion python/test/Ice/optional/ServerAMD.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def opVarStruct(self, p1, current=None):
def opOneOptional(self, p1, current=None):
return Ice.Future.completed((p1, p1))

def opOneOptionalProxy(self, p1, current=None):
def opMyInterfaceProxy(self, p1, current=None):
return Ice.Future.completed((p1, p1))

def opByteSeq(self, p1, current=None):
Expand Down
9 changes: 7 additions & 2 deletions python/test/Ice/optional/Test.ice
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class OneOptional
optional(1) int a;
}

interface MyInterface
{
void op();
}

enum MyEnum
{
MyEnumMember
Expand Down Expand Up @@ -77,7 +82,7 @@ class MultiOptional
optional(7) double g;
optional(8) string h;
optional(9) MyEnum i;
optional(10) MultiOptional* j;
optional(10) MyInterface* j;
optional(11) MultiOptional k;
optional(12) ByteSeq bs;
optional(13) StringSeq ss;
Expand Down Expand Up @@ -236,7 +241,7 @@ interface Initial

optional(1) OneOptional opOneOptional(optional(2) OneOptional p1, out optional(3) OneOptional p3);

optional(1) OneOptional* opOneOptionalProxy(optional(2) OneOptional* p1, out optional(3) OneOptional* p3);
optional(1) MyInterface* opMyInterfaceProxy(optional(2) MyInterface* p1, out optional(3) MyInterface* p3);

optional(1) ByteSeq opByteSeq(optional(2) ByteSeq p1, out optional(3) ByteSeq p3);

Expand Down

0 comments on commit f47e8db

Please sign in to comment.