20 #include <cppcutter.h>
27 namespace test_dat_file
35 g_mkdir_with_parents(
base_dir, 0755);
49 cppcut_assert_null(file.
ptr());
59 cut_fail(
"A zero-byte request is not allowed.");
64 cppcut_assert_not_null(file.
ptr());
70 cppcut_assert_equal(static_cast<grn::dat::UInt8>(
i), buf[
i]);
78 std::strcat(path,
"/test_create_with_path.dat");
84 cut_fail(
"A zero-byte request is not allowed.");
89 cppcut_assert_not_null(file.
ptr());
95 cppcut_assert_equal(static_cast<grn::dat::UInt8>(
i), buf[
i]);
103 std::strcat(path,
"/test_open.dat");
109 cut_fail(
"A null-path request is not allowed.");
114 std::strcpy(static_cast<char *>(file.
ptr()),
"This is a pen.");
117 cut_assert_null(file.
ptr());
121 cppcut_assert_not_null(file.
ptr());
123 cppcut_assert_equal(0, std::strcmp(static_cast<char *>(file.
ptr()),
132 cppcut_assert_not_null(file.
ptr());
136 file_new.
swap(&file);
138 cut_assert_null(file.
ptr());
141 cppcut_assert_not_null(file_new.ptr());