[Yunq] Add a basic yunq test into libyunq.
This commit is contained in:
parent
9c860dd6a4
commit
fecaa387b0
21 changed files with 189 additions and 936 deletions
23
lib/yunq/test/yunq_test.cpp
Normal file
23
lib/yunq/test/yunq_test.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "example/example.yunq.h"
|
||||
|
||||
TEST_CASE("Basic Setter/Getter", "[yunq]") {
|
||||
ex::Basic b;
|
||||
b.set_field(1);
|
||||
REQUIRE(b.field() == 1);
|
||||
}
|
||||
|
||||
TEST_CASE("Basic serialization", "[yunq]") {
|
||||
ex::Basic a;
|
||||
a.set_field(1);
|
||||
|
||||
glcr::ByteBuffer buf(1024);
|
||||
a.SerializeToBytes(buf, 0);
|
||||
|
||||
ex::Basic b;
|
||||
yunq::MessageView v(buf, 0);
|
||||
REQUIRE(b.ParseFromBytes(v).ok() == true);
|
||||
|
||||
REQUIRE(b.field() == 1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue