summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2020-04-23 19:23:00 +0200
committerJose <jose@zeroc.com>2020-04-23 19:23:00 +0200
commitbe735ae610d43ec4feab7f70c748a98b945efbe0 (patch)
tree7f3e541d39283c75590c9f5cb275cbc98548139a
parentNuGet package build fixes (diff)
downloadice-be735ae610d43ec4feab7f70c748a98b945efbe0.tar.bz2
ice-be735ae610d43ec4feab7f70c748a98b945efbe0.tar.xz
ice-be735ae610d43ec4feab7f70c748a98b945efbe0.zip
Bug in optional test for tagged sequences - Close #803
-rw-r--r--csharp/test/Ice/optional/AllTests.cs7
-rw-r--r--java-compat/test/src/main/java/test/Ice/optional/AllTests.java7
-rw-r--r--java/test/src/main/java/test/Ice/optional/AllTests.java7
3 files changed, 12 insertions, 9 deletions
diff --git a/csharp/test/Ice/optional/AllTests.cs b/csharp/test/Ice/optional/AllTests.cs
index ff22e083443..2f64f49cd2a 100644
--- a/csharp/test/Ice/optional/AllTests.cs
+++ b/csharp/test/Ice/optional/AllTests.cs
@@ -1678,7 +1678,6 @@ namespace Ice
os = new Ice.OutputStream(communicator);
os.startEncapsulation();
os.writeOptional(2, Ice.OptionalFormat.VSize);
- os.writeSize(p1.Value.Length +(p1.Value.Length > 254 ? 5 : 1));
Test.SmallStructSeqHelper.write(os, p1.Value);
os.endEncapsulation();
inEncaps = os.finished();
@@ -1686,15 +1685,17 @@ namespace Ice
@in = new Ice.InputStream(communicator, outEncaps);
@in.startEncapsulation();
test(@in.readOptional(1, Ice.OptionalFormat.VSize));
- @in.skipSize();
Test.SmallStruct[] arr = Test.SmallStructSeqHelper.read(@in);
test(ArraysEqual(arr, p1.Value));
test(@in.readOptional(3, Ice.OptionalFormat.VSize));
- @in.skipSize();
arr = Test.SmallStructSeqHelper.read(@in);
test(ArraysEqual(arr, p1.Value));
@in.endEncapsulation();
+ // Check the outEncaps size matches the expected size, 6 bytes for the encapsulation, plus each
+ // 12 bytes for each sequence ( 1 byte tag, 1 byte size, 10 byte contents)
+ test(outEncaps.Length == 12 + 12 + 6);
+
@in = new Ice.InputStream(communicator, outEncaps);
@in.startEncapsulation();
@in.endEncapsulation();
diff --git a/java-compat/test/src/main/java/test/Ice/optional/AllTests.java b/java-compat/test/src/main/java/test/Ice/optional/AllTests.java
index c3acb48f877..3a19cd0a1a3 100644
--- a/java-compat/test/src/main/java/test/Ice/optional/AllTests.java
+++ b/java-compat/test/src/main/java/test/Ice/optional/AllTests.java
@@ -1687,7 +1687,6 @@ public class AllTests
os = new Ice.OutputStream(communicator);
os.startEncapsulation();
os.writeOptional(2, Ice.OptionalFormat.VSize);
- os.writeSize(p1.get().length + (p1.get().length > 254 ? 5 : 1));
SmallStructSeqHelper.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
@@ -1695,14 +1694,12 @@ public class AllTests
in = new Ice.InputStream(communicator, outEncaps.value);
in.startEncapsulation();
test(in.readOptional(1, Ice.OptionalFormat.VSize));
- in.skipSize();
SmallStruct[] arr = SmallStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
{
test(arr[i].equals(p1.get()[i]));
}
test(in.readOptional(3, Ice.OptionalFormat.VSize));
- in.skipSize();
arr = SmallStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
{
@@ -1710,6 +1707,10 @@ public class AllTests
}
in.endEncapsulation();
+ // Check the outEncaps size matches the expected size, 6 bytes for the encapsulation, plus 12 bytes
+ // for each sequence (1 byte tag, 1 byte size, 10 byte contents)
+ test(outEncaps.value.length == 12 + 12 + 6);
+
in = new Ice.InputStream(communicator, outEncaps.value);
in.startEncapsulation();
in.endEncapsulation();
diff --git a/java/test/src/main/java/test/Ice/optional/AllTests.java b/java/test/src/main/java/test/Ice/optional/AllTests.java
index 56aba5aeab3..1b15928b90d 100644
--- a/java/test/src/main/java/test/Ice/optional/AllTests.java
+++ b/java/test/src/main/java/test/Ice/optional/AllTests.java
@@ -1563,7 +1563,6 @@ public class AllTests
os = new OutputStream(communicator);
os.startEncapsulation();
os.writeOptional(2, OptionalFormat.VSize);
- os.writeSize(p1.get().length + (p1.get().length > 254 ? 5 : 1));
SmallStructSeqHelper.write(os, p1.get());
os.endEncapsulation();
inEncaps = os.finished();
@@ -1571,14 +1570,12 @@ public class AllTests
in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
test(in.readOptional(1, OptionalFormat.VSize));
- in.skipSize();
SmallStruct[] arr = SmallStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
{
test(arr[i].equals(p1.get()[i]));
}
test(in.readOptional(3, OptionalFormat.VSize));
- in.skipSize();
arr = SmallStructSeqHelper.read(in);
for(int i = 0; i < p1.get().length; ++i)
{
@@ -1586,6 +1583,10 @@ public class AllTests
}
in.endEncapsulation();
+ // Check the outEncaps size matches the expected size, 6 bytes for the encapsulation, plus 12 bytes
+ // for each sequence (1 byte tag, 1 byte size, 10 byte contents)
+ test(inv.outParams.length == 12 + 12 + 6);
+
in = new InputStream(communicator, inv.outParams);
in.startEncapsulation();
in.endEncapsulation();