2019-05-19 12:33:42 +00:00
|
|
|
#include <gtest/gtest.h>
|
2020-06-16 21:39:45 +00:00
|
|
|
#include "webfuse_provider/impl/status_intern.h"
|
2019-05-19 12:33:42 +00:00
|
|
|
|
2020-06-16 21:57:41 +00:00
|
|
|
TEST(wfp_status, tostring)
|
2019-05-19 12:33:42 +00:00
|
|
|
{
|
2020-06-16 21:57:41 +00:00
|
|
|
ASSERT_STREQ("Good", wfp_status_tostring(WFP_GOOD));
|
|
|
|
ASSERT_STREQ("Bad", wfp_status_tostring(WFP_BAD));
|
|
|
|
ASSERT_STREQ("Bad (not implemented)", wfp_status_tostring(WFP_BAD_NOTIMPLEMENTED));
|
|
|
|
ASSERT_STREQ("Bad (busy)", wfp_status_tostring(WFP_BAD_BUSY));
|
|
|
|
ASSERT_STREQ("Bad (timeout)", wfp_status_tostring(WFP_BAD_TIMEOUT));
|
|
|
|
ASSERT_STREQ("Bad (format)", wfp_status_tostring(WFP_BAD_FORMAT));
|
|
|
|
ASSERT_STREQ("Bad (no entry)", wfp_status_tostring(WFP_BAD_NOENTRY));
|
|
|
|
ASSERT_STREQ("Bad (access denied)", wfp_status_tostring(WFP_BAD_ACCESS_DENIED));
|
2019-05-19 12:33:42 +00:00
|
|
|
|
2020-06-16 21:57:41 +00:00
|
|
|
ASSERT_STREQ("Bad (unknown)", wfp_status_tostring(-1));
|
2019-05-19 12:33:42 +00:00
|
|
|
}
|
|
|
|
|
2020-06-16 21:57:41 +00:00
|
|
|
TEST(wfp_status, to_rc)
|
2019-05-19 12:33:42 +00:00
|
|
|
{
|
2020-06-16 21:57:41 +00:00
|
|
|
ASSERT_EQ(0, wfp_status_to_rc(WFP_GOOD));
|
|
|
|
ASSERT_EQ(-ENOENT, wfp_status_to_rc(WFP_BAD));
|
|
|
|
ASSERT_EQ(-ENOSYS, wfp_status_to_rc(WFP_BAD_NOTIMPLEMENTED));
|
|
|
|
ASSERT_EQ(-ENOENT, wfp_status_to_rc(WFP_BAD_BUSY));
|
|
|
|
ASSERT_EQ(-ETIMEDOUT, wfp_status_to_rc(WFP_BAD_TIMEOUT));
|
|
|
|
ASSERT_EQ(-ENOENT, wfp_status_to_rc(WFP_BAD_FORMAT));
|
|
|
|
ASSERT_EQ(-ENOENT, wfp_status_to_rc(WFP_BAD_NOENTRY));
|
|
|
|
ASSERT_EQ(-EACCES, wfp_status_to_rc(WFP_BAD_ACCESS_DENIED));
|
2019-05-19 12:33:42 +00:00
|
|
|
|
2020-06-16 21:57:41 +00:00
|
|
|
ASSERT_EQ(-ENOENT, wfp_status_to_rc(-1));
|
2019-05-19 12:33:42 +00:00
|
|
|
}
|