[Yunq] Add tests for capability serialization.
This commit is contained in:
parent
01e10fb47e
commit
9222f59da3
|
@ -50,3 +50,39 @@ TEST_CASE("Types Serialization", "[yunq]") {
|
|||
REQUIRE(b.signed_int() == -1);
|
||||
REQUIRE(b.str() == "test");
|
||||
}
|
||||
|
||||
TEST_CASE("Cap Setter/Getter", "[yunq]") {
|
||||
ex::Cap c;
|
||||
c.set_cap(1234);
|
||||
|
||||
REQUIRE(c.cap() == 1234);
|
||||
}
|
||||
|
||||
TEST_CASE("Cap Serialization Inline", "[yunq]") {
|
||||
ex::Cap a;
|
||||
a.set_cap(1234);
|
||||
|
||||
glcr::ByteBuffer buf(1024);
|
||||
a.SerializeToBytes(buf, 0);
|
||||
|
||||
ex::Cap b;
|
||||
yunq::MessageView v(buf, 0);
|
||||
REQUIRE(b.ParseFromBytes(v).ok() == true);
|
||||
|
||||
REQUIRE(b.cap() == 1234);
|
||||
}
|
||||
|
||||
TEST_CASE("Cap Serialization Sidebuffer", "[yunq]") {
|
||||
ex::Cap a;
|
||||
a.set_cap(1234);
|
||||
|
||||
glcr::ByteBuffer buf(1024);
|
||||
glcr::CapBuffer caps(1);
|
||||
a.SerializeToBytes(buf, 0, caps);
|
||||
|
||||
ex::Cap b;
|
||||
yunq::MessageView v(buf, 0);
|
||||
REQUIRE(b.ParseFromBytes(v, caps).ok() == true);
|
||||
|
||||
REQUIRE(b.cap() == 1234);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue