mirror of
https://github.com/falk-werner/webfuse
synced 2024-10-27 20:34:10 +00:00
adds tests of wf_message
This commit is contained in:
parent
d14861d478
commit
b9395180e2
@ -308,6 +308,7 @@ add_executable(alltests
|
|||||||
test/test_static_filesystem.cc
|
test/test_static_filesystem.cc
|
||||||
test/test_fuse_req.cc
|
test/test_fuse_req.cc
|
||||||
test/test_status.cc
|
test/test_status.cc
|
||||||
|
test/test_message.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(alltests PUBLIC webfuse-adapter-static webfuse-provider-static webfuse-core ${EXTRA_LIBS} ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES})
|
target_link_libraries(alltests PUBLIC webfuse-adapter-static webfuse-provider-static webfuse-core ${EXTRA_LIBS} ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES})
|
||||||
|
22
test/test_message.cc
Normal file
22
test/test_message.cc
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <cstring>
|
||||||
|
#include "webfuse/core/message.h"
|
||||||
|
|
||||||
|
TEST(wf_message, create)
|
||||||
|
{
|
||||||
|
json_t * value = json_object();
|
||||||
|
|
||||||
|
struct wf_message * message = wf_message_create(value);
|
||||||
|
ASSERT_NE(nullptr, message);
|
||||||
|
ASSERT_EQ(2, message->length);
|
||||||
|
ASSERT_TRUE(0 == strncmp("{}", message->data, 2));
|
||||||
|
|
||||||
|
wf_message_dispose(message);
|
||||||
|
json_decref(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(wf_message, fail_to_create)
|
||||||
|
{
|
||||||
|
struct wf_message * message = wf_message_create(nullptr);
|
||||||
|
ASSERT_EQ(nullptr, message);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user