2019-05-19 12:33:42 +00:00
|
|
|
#include <gtest/gtest.h>
|
2020-06-28 17:43:08 +00:00
|
|
|
#include "webfuse/impl/status.h"
|
2019-05-19 12:33:42 +00:00
|
|
|
|
|
|
|
TEST(wf_status, tostring)
|
|
|
|
{
|
2020-06-28 17:43:08 +00:00
|
|
|
ASSERT_STREQ("Good", wf_impl_status_tostring(WF_GOOD));
|
|
|
|
ASSERT_STREQ("Bad", wf_impl_status_tostring(WF_BAD));
|
|
|
|
ASSERT_STREQ("Bad (not implemented)", wf_impl_status_tostring(WF_BAD_NOTIMPLEMENTED));
|
|
|
|
ASSERT_STREQ("Bad (busy)", wf_impl_status_tostring(WF_BAD_BUSY));
|
|
|
|
ASSERT_STREQ("Bad (timeout)", wf_impl_status_tostring(WF_BAD_TIMEOUT));
|
|
|
|
ASSERT_STREQ("Bad (format)", wf_impl_status_tostring(WF_BAD_FORMAT));
|
|
|
|
ASSERT_STREQ("Bad (no entry)", wf_impl_status_tostring(WF_BAD_NOENTRY));
|
|
|
|
ASSERT_STREQ("Bad (access denied)", wf_impl_status_tostring(WF_BAD_ACCESS_DENIED));
|
2019-05-19 12:33:42 +00:00
|
|
|
|
2020-06-28 17:43:08 +00:00
|
|
|
ASSERT_STREQ("Bad (unknown)", wf_impl_status_tostring(-1));
|
2019-05-19 12:33:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(wf_status, to_rc)
|
|
|
|
{
|
2020-06-28 17:43:08 +00:00
|
|
|
ASSERT_EQ(0, wf_impl_status_to_rc(WF_GOOD));
|
|
|
|
ASSERT_EQ(-ENOENT, wf_impl_status_to_rc(WF_BAD));
|
|
|
|
ASSERT_EQ(-ENOSYS, wf_impl_status_to_rc(WF_BAD_NOTIMPLEMENTED));
|
|
|
|
ASSERT_EQ(-ENOENT, wf_impl_status_to_rc(WF_BAD_BUSY));
|
|
|
|
ASSERT_EQ(-ETIMEDOUT, wf_impl_status_to_rc(WF_BAD_TIMEOUT));
|
|
|
|
ASSERT_EQ(-ENOENT, wf_impl_status_to_rc(WF_BAD_FORMAT));
|
|
|
|
ASSERT_EQ(-ENOENT, wf_impl_status_to_rc(WF_BAD_NOENTRY));
|
|
|
|
ASSERT_EQ(-EACCES, wf_impl_status_to_rc(WF_BAD_ACCESS_DENIED));
|
2019-05-19 12:33:42 +00:00
|
|
|
|
2020-06-28 17:43:08 +00:00
|
|
|
ASSERT_EQ(-ENOENT, wf_impl_status_to_rc(-1));
|
2019-05-19 12:33:42 +00:00
|
|
|
}
|