Skip to content

Commit 41ee355

Browse files
authored
Merge pull request #176 from thbeu/add-test
Add missing unit test for 1a344bf to reflect behavioral change
2 parents c4dce86 + dfade6d commit 41ee355

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

tests/dbf_test.cc

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ TEST(DBFFieldTest, SetAndGetLogicalFalse)
309309
fs::remove(filename);
310310
}
311311

312-
TEST(DBFFieldTest, SetAndGetLogicalInvalid)
312+
TEST(DBFFieldTest, SetLogicalInvalid)
313313
{
314314
const auto filename =
315315
fs::temp_directory_path() / GenerateUniqueFilename(".dbf");
@@ -318,6 +318,29 @@ TEST(DBFFieldTest, SetAndGetLogicalInvalid)
318318
fs::remove(filename);
319319
}
320320

321+
TEST(DBFFieldTest, SetAndGetDouble)
322+
{
323+
const auto filename =
324+
fs::temp_directory_path() / GenerateUniqueFilename(".dbf");
325+
constexpr const double value = 1623819823.809;
326+
{
327+
const auto handle = DBFCreate(filename.string().c_str());
328+
EXPECT_NE(nullptr, handle);
329+
const auto fid = DBFAddField(handle, "double", FTDouble, 14, 4);
330+
EXPECT_GE(fid, 0);
331+
const auto success = DBFWriteDoubleAttribute(handle, 0, 0, value);
332+
EXPECT_TRUE(success);
333+
DBFClose(handle);
334+
}
335+
{
336+
const auto handle = DBFOpen(filename.string().c_str(), "r");
337+
EXPECT_NE(nullptr, handle);
338+
EXPECT_EQ(value, DBFReadDoubleAttribute(handle, 0, 0));
339+
DBFClose(handle);
340+
}
341+
fs::remove(filename);
342+
}
343+
321344
static auto WriteDuplicateFields(const fs::path &filename) -> auto
322345
{
323346
const auto handle = DBFCreate(filename.string().c_str());

0 commit comments

Comments
 (0)