2020-06-16 21:39:45 +00:00
|
|
|
#include "webfuse_provider/impl/dirbuffer.h"
|
2020-06-14 19:15:39 +00:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
TEST(DirBuffer, CreateDispose)
|
|
|
|
{
|
|
|
|
wfp_dirbuffer * buffer = wfp_impl_dirbuffer_create();
|
|
|
|
wfp_impl_dirbuffer_dispose(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(DirBuffer, Add)
|
|
|
|
{
|
|
|
|
wfp_dirbuffer * buffer = wfp_impl_dirbuffer_create();
|
|
|
|
wfp_impl_dirbuffer_add(buffer, "answer", 42);
|
|
|
|
|
2020-07-10 22:17:03 +00:00
|
|
|
ASSERT_EQ(1, wfp_impl_dirbuffer_size(buffer));
|
2020-06-14 19:15:39 +00:00
|
|
|
|
2020-07-10 22:17:03 +00:00
|
|
|
auto * entry = wfp_impl_dirbuffer_entry_at(buffer, 0);
|
|
|
|
ASSERT_STREQ("answer", entry->name);
|
|
|
|
ASSERT_EQ(42, entry->inode);
|
2020-06-14 19:15:39 +00:00
|
|
|
|
|
|
|
wfp_impl_dirbuffer_dispose(buffer);
|
|
|
|
}
|
|
|
|
|
2020-07-10 22:17:03 +00:00
|
|
|
TEST(DirBuffer, EntryAt)
|
2020-06-14 19:15:39 +00:00
|
|
|
{
|
|
|
|
wfp_dirbuffer * buffer = wfp_impl_dirbuffer_create();
|
2020-07-10 22:17:03 +00:00
|
|
|
auto * entry = wfp_impl_dirbuffer_entry_at(buffer, 0);
|
|
|
|
ASSERT_EQ(nullptr, entry);
|
2020-06-14 19:15:39 +00:00
|
|
|
wfp_impl_dirbuffer_dispose(buffer);
|
|
|
|
}
|