From 752e7a6bead50f656cdd1fc7d2e2db080db4cb0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Sun, 8 Oct 2017 22:30:34 +0200 Subject: [PATCH] Add simple unit tests for DataBuf --- unitTests/test_types.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/unitTests/test_types.cpp b/unitTests/test_types.cpp index 4ca7bd27..59e2d116 100644 --- a/unitTests/test_types.cpp +++ b/unitTests/test_types.cpp @@ -23,4 +23,16 @@ TEST(ExivTime, doesNotGetTimeWithBadFormedString) ASSERT_EQ(1, exifTime("007:a5:24 aa:bb:cc", &tmInstance)); } +TEST(DataBuf, pointsToNullByDefault) +{ + DataBuf instance; + ASSERT_EQ(NULL, instance.pData_); + ASSERT_EQ(0, instance.size_); +} + +TEST(DataBuf, allocatesDataWithNonEmptyConstructor) +{ + DataBuf instance (5); + ASSERT_NE(static_cast(NULL), instance.pData_); /// \todo use nullptr once we move to c++11 + ASSERT_EQ(5, instance.size_); }