Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F7892983
serialization-test.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
serialization-test.cpp
View Options
/*
* This file is part of libkazv.
* SPDX-FileCopyrightText: 2021 Tusooa Zhu <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include
<libkazv-config.hpp>
#include
<catch2/catch_all.hpp>
#include
<boost/asio.hpp>
#include
<sstream>
#include
<boost/archive/text_iarchive.hpp>
#include
<boost/archive/text_oarchive.hpp>
#include
<sdk-model.hpp>
#include
<client.hpp>
#include
<asio-promise-handler.hpp>
#include
"client-test-util.hpp"
using
namespace
Kazv
;
using
IAr
=
boost
::
archive
::
text_iarchive
;
using
OAr
=
boost
::
archive
::
text_oarchive
;
TEST_CASE
(
"Serialize SdkModel"
,
"[client][serialization]"
)
{
SdkModel
m1
;
SdkModel
m2
;
std
::
stringstream
stream
;
{
auto
ar
=
OAr
(
stream
);
ar
<<
m1
;
}
{
auto
ar
=
IAr
(
stream
);
ar
>>
m2
;
}
}
TEST_CASE
(
"Serialize from Client to archive"
,
"[client][serialization]"
)
{
boost
::
asio
::
io_context
io
;
AsioPromiseHandler
ph
{
io
.
get_executor
()};
auto
store
=
createTestClientStore
(
ph
);
auto
c
=
Client
(
store
.
reader
().
map
([](
auto
c
)
{
return
SdkModel
{
c
};
}),
store
,
std
::
nullopt
);
std
::
stringstream
stream
;
{
auto
ar
=
OAr
(
stream
);
c
.
serializeTo
(
ar
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Thu, Oct 2, 4:44 AM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
484219
Default Alt Text
serialization-test.cpp (1 KB)
Attached To
Mode
rL libkazv
Attached
Detach File
Event Timeline
Log In to Comment