summaryrefslogtreecommitdiffstats
path: root/embedding
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-06 16:04:18 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-07-06 16:04:18 (GMT)
commit9cc762d85afffea42de3e1d156a6b8838d88a00c (patch)
treebff170c0493759c7f1bffca2648960b6f43ca139 /embedding
parentbe98a8297b4e10e169290f497e649e803e43d791 (diff)
downloaduscxml-9cc762d85afffea42de3e1d156a6b8838d88a00c.zip
uscxml-9cc762d85afffea42de3e1d156a6b8838d88a00c.tar.gz
uscxml-9cc762d85afffea42de3e1d156a6b8838d88a00c.tar.bz2
Made Blob into Pimpl to better support language bindings
Diffstat (limited to 'embedding')
-rw-r--r--embedding/csharp/uSCXMLEmbedding.suobin37376 -> 40448 bytes
-rw-r--r--embedding/csharp/uSCXMLEmbedding/RunTests.cs29
-rw-r--r--embedding/java/src/org/uscxml/tests/TestData.java30
3 files changed, 57 insertions, 2 deletions
diff --git a/embedding/csharp/uSCXMLEmbedding.suo b/embedding/csharp/uSCXMLEmbedding.suo
index 823eecc..3d75994 100644
--- a/embedding/csharp/uSCXMLEmbedding.suo
+++ b/embedding/csharp/uSCXMLEmbedding.suo
Binary files differ
diff --git a/embedding/csharp/uSCXMLEmbedding/RunTests.cs b/embedding/csharp/uSCXMLEmbedding/RunTests.cs
index 38e3736..d2b188d 100644
--- a/embedding/csharp/uSCXMLEmbedding/RunTests.cs
+++ b/embedding/csharp/uSCXMLEmbedding/RunTests.cs
@@ -32,6 +32,7 @@ namespace embedding
int i = 1;
while (i-- > 0)
{
+ testData();
testLifeCycle();
testExecutableContent();
testIOProcessor();
@@ -40,6 +41,34 @@ namespace embedding
Console.ReadKey();
}
+ public static void testData() {
+ byte[] origData = new byte[1024];
+ for (int i = 0; i < origData.Length; i++) {
+ origData[i] = (byte)i;
+ }
+
+ {
+
+ Blob blob = new Blob(origData, "application/octet-stream");
+ Debug.Assert(origData.Length == blob.getSize());
+
+ for (int i = 0; i < origData.Length; i++) {
+ Debug.Assert(origData[i] == blob.getData()[i]);
+ }
+ }
+
+ Data data = new Data(origData, "application/octet-stream");
+ Blob blob2 = data.getBinary();
+
+ byte[] newData = blob2.getData();
+
+ if (newData.Length == origData.Length);
+ for (int i = 0; i < origData.Length; i++) {
+ Debug.Assert(newData[i] == origData[i]);
+ }
+
+ }
+
public static void testInvoker() {
Console.WriteLine("testInvoker");
CustomInvoker invoker = new CustomInvoker();
diff --git a/embedding/java/src/org/uscxml/tests/TestData.java b/embedding/java/src/org/uscxml/tests/TestData.java
index ca1da00..d225dec 100644
--- a/embedding/java/src/org/uscxml/tests/TestData.java
+++ b/embedding/java/src/org/uscxml/tests/TestData.java
@@ -1,6 +1,7 @@
package org.uscxml.tests;
import org.uscxml.Blob;
+import org.uscxml.BlobImpl;
import org.uscxml.Data;
public class TestData {
@@ -17,8 +18,33 @@ public class TestData {
}
{
- byte binData[] = new byte[1024];
- Data data = new Data(binData, "application/octet-stream");
+ byte origData[] = new byte[1024];
+ for (int i = 0; i < origData.length; i++) {
+ origData[i] = (byte)i;
+ }
+
+ {
+ Blob blob = new Blob(origData, "application/octet-stream");
+ if (origData.length != blob.getSize()) throw new RuntimeException("Blob does not match");
+
+ for (int i = 0; i < origData.length; i++) {
+ if (origData[i] != blob.getData()[i])
+ throw new RuntimeException("Blob mismatch at " + i);
+ }
+ }
+
+ Data data = new Data(origData, "application/octet-stream");
+ Blob blob = data.getBinary();
+ System.out.println(blob.getSize());
+
+ byte newData[] = blob.getData();
+
+ if (newData.length != origData.length) throw new RuntimeException("Arrays length does not match");
+ for (int i = 0; i < origData.length; i++) {
+ if (newData[i] != origData[i])
+ throw new RuntimeException("Mismatch at " + i);
+ }
+
}
}