1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00

adds test of wf_status

This commit is contained in:
Falk Werner 2019-04-27 13:20:59 +02:00
parent 5c72122d25
commit d14861d478
4 changed files with 34 additions and 2 deletions

View File

@ -306,6 +306,8 @@ add_executable(alltests
test/test_slist.cc
test/test_path.cc
test/test_static_filesystem.cc
test/test_fuse_req.cc
test/test_status.cc
)
target_link_libraries(alltests PUBLIC webfuse-adapter-static webfuse-provider-static webfuse-core ${EXTRA_LIBS} ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES})

View File

@ -23,7 +23,7 @@ char const * wf_status_tostring(wf_status status)
{
case WF_GOOD: return "Good";
case WF_BAD: return "Bad";
case WF_BAD_NOTIMPLEMENTED: return "Bad (not implelemted)";
case WF_BAD_NOTIMPLEMENTED: return "Bad (not implemented)";
case WF_BAD_TIMEOUT: return "Bad (timeout)";
case WF_BAD_BUSY: return "Bad (busy)";
case WF_BAD_FORMAT: return "Bad (format)";

View File

@ -1,5 +1,5 @@
#include <gtest/gtest.h>
#include "webfuse/adapter/fuse_wrapper.h"
#include "webfuse/adapter/impl/fuse_wrapper.h"
TEST(libfuse, fuse_req_t_size)
{

30
test/test_status.cc Normal file
View File

@ -0,0 +1,30 @@
#include <gtest/gtest.h>
#include "webfuse/core/status_intern.h"
TEST(wf_status, tostring)
{
ASSERT_STREQ("Good", wf_status_tostring(WF_GOOD));
ASSERT_STREQ("Bad", wf_status_tostring(WF_BAD));
ASSERT_STREQ("Bad (not implemented)", wf_status_tostring(WF_BAD_NOTIMPLEMENTED));
ASSERT_STREQ("Bad (busy)", wf_status_tostring(WF_BAD_BUSY));
ASSERT_STREQ("Bad (timeout)", wf_status_tostring(WF_BAD_TIMEOUT));
ASSERT_STREQ("Bad (format)", wf_status_tostring(WF_BAD_FORMAT));
ASSERT_STREQ("Bad (no entry)", wf_status_tostring(WF_BAD_NOENTRY));
ASSERT_STREQ("Bad (access denied)", wf_status_tostring(WF_BAD_ACCESS_DENIED));
ASSERT_STREQ("Bad (unknown)", wf_status_tostring(-1));
}
TEST(wf_status, to_rc)
{
ASSERT_EQ(0, wf_status_to_rc(WF_GOOD));
ASSERT_EQ(-ENOENT, wf_status_to_rc(WF_BAD));
ASSERT_EQ(-ENOSYS, wf_status_to_rc(WF_BAD_NOTIMPLEMENTED));
ASSERT_EQ(-ENOENT, wf_status_to_rc(WF_BAD_BUSY));
ASSERT_EQ(-ETIMEDOUT, wf_status_to_rc(WF_BAD_TIMEOUT));
ASSERT_EQ(-ENOENT, wf_status_to_rc(WF_BAD_FORMAT));
ASSERT_EQ(-ENOENT, wf_status_to_rc(WF_BAD_NOENTRY));
ASSERT_EQ(-EACCES, wf_status_to_rc(WF_BAD_ACCESS_DENIED));
ASSERT_EQ(-ENOENT, wf_status_to_rc(-1));
}