test schemas
This commit is contained in:
parent
a68b6ed81a
commit
a10e48d140
3 changed files with 142 additions and 0 deletions
59
runtime/src/test/schema/demo.capnp
Normal file
59
runtime/src/test/schema/demo.capnp
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
@0xb6577a1582e84742;
|
||||||
|
|
||||||
|
using Java = import "/capnp/java.capnp";
|
||||||
|
$Java.package("org.capnproto.demo");
|
||||||
|
$Java.outerClassname("Demo");
|
||||||
|
|
||||||
|
struct TestParams0 {
|
||||||
|
param0 @0 :Int32;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TestResults0 {
|
||||||
|
result0 @0 :Int32;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TestParams1 {
|
||||||
|
param0 @0 :AnyPointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TestResults1 {
|
||||||
|
result0 @0 :AnyPointer;
|
||||||
|
result1 @1 :AnyPointer;
|
||||||
|
result2 @2 :AnyPointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Struct0 {
|
||||||
|
f0 @0 :Bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Iface0 {
|
||||||
|
method0 @0 ();
|
||||||
|
method1 @1 () -> stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Struct2 {
|
||||||
|
f0 @0 :AnyPointer;
|
||||||
|
f1i @1 :Iface0;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TestCap0 {
|
||||||
|
testMethod0 @0 TestParams0 -> TestResults0;
|
||||||
|
testMethod1 @1 TestParams1 -> TestResults1;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TestCap1 {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface Iface1 {
|
||||||
|
|
||||||
|
struct Struct1 {
|
||||||
|
f0 @0 :Bool;
|
||||||
|
f1 @1 :AnyPointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
method0 @0 () -> (result0 :Struct0, result1 :Struct1);
|
||||||
|
method1 @1 () -> (result0: Iface0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
27
runtime/src/test/schema/generics.capnp
Normal file
27
runtime/src/test/schema/generics.capnp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
@0xbf250a886b8a4258;
|
||||||
|
|
||||||
|
using Java = import "/capnp/java.capnp";
|
||||||
|
$Java.package("org.capnproto.test");
|
||||||
|
$Java.outerClassname("TestGenerics");
|
||||||
|
|
||||||
|
interface Aaa {
|
||||||
|
struct S {
|
||||||
|
bar @0 :UInt32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Sss(X) {
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Bbb(X) {
|
||||||
|
|
||||||
|
foo @0 (value: Aaa);
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Ccc(X) {
|
||||||
|
}
|
||||||
|
|
||||||
|
#interface Ddd(X, Y) {
|
||||||
|
# foo @0 (value: X);
|
||||||
|
# bar @1 () -> (value: X);
|
||||||
|
#}
|
56
runtime/src/test/schema/test.capnp
Normal file
56
runtime/src/test/schema/test.capnp
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
@0xb365fb00cc89383b;
|
||||||
|
|
||||||
|
using Java = import "/capnp/java.capnp";
|
||||||
|
$Java.package("org.capnproto.test");
|
||||||
|
$Java.outerClassname("Test");
|
||||||
|
|
||||||
|
struct TestAllTypes {
|
||||||
|
voidField @0 : Void;
|
||||||
|
boolField @1 : Bool;
|
||||||
|
int8Field @2 : Int8;
|
||||||
|
int16Field @3 : Int16;
|
||||||
|
int32Field @4 : Int32;
|
||||||
|
int64Field @5 : Int64;
|
||||||
|
uInt8Field @6 : UInt8;
|
||||||
|
uInt16Field @7 : UInt16;
|
||||||
|
uInt32Field @8 : UInt32;
|
||||||
|
uInt64Field @9 : UInt64;
|
||||||
|
float32Field @10 : Float32;
|
||||||
|
float64Field @11 : Float64;
|
||||||
|
textField @12 : Text;
|
||||||
|
dataField @13 : Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TestInterface {
|
||||||
|
foo @0 (i :UInt32, j :Bool) -> (x :Text);
|
||||||
|
bar @1 () -> ();
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TestExtends extends(TestInterface) {
|
||||||
|
qux @0 ();
|
||||||
|
corge @1 TestAllTypes -> ();
|
||||||
|
grault @2 () -> TestAllTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TestExtends2 extends(TestExtends) {}
|
||||||
|
|
||||||
|
interface TestPipeline {
|
||||||
|
getCap @0 (n: UInt32, inCap :TestInterface) -> (s: Text, outBox :Box);
|
||||||
|
testPointers @1 (cap :TestInterface, obj :AnyPointer, list :List(TestInterface)) -> ();
|
||||||
|
getAnyCap @2 (n: UInt32, inCap :Capability) -> (s: Text, outBox :AnyBox);
|
||||||
|
|
||||||
|
struct Box {
|
||||||
|
cap @0 :TestInterface;
|
||||||
|
}
|
||||||
|
struct AnyBox {
|
||||||
|
cap @0 :Capability;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct TestGenerics(Foo, Bar) {
|
||||||
|
foo @0 :Foo;
|
||||||
|
rev @1 :TestGenerics(Bar, Foo);
|
||||||
|
|
||||||
|
interface Interface(Qux) {
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue