diff --git a/CMakeLists.txt b/CMakeLists.txt index 87a167ce..96426850 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,10 @@ if( EXIV2_ENABLE_COMMERCIAL ) set (EXIV2_ENABLE_NLS OFF) endif() +if( EXIV2_BUILD_UNIT_TESTS ) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) # Requires CMake 3.3.3 +endif() + include(config/findDependencies.cmake) include(config/compilerFlags.cmake) include( config/generateConfigFile.cmake ) diff --git a/unitTests/CMakeLists.txt b/unitTests/CMakeLists.txt index 2f141d2e..735543ed 100644 --- a/unitTests/CMakeLists.txt +++ b/unitTests/CMakeLists.txt @@ -1,10 +1,11 @@ add_executable(unit_tests mainTestRunner.cpp - test_types.cpp gtestwrapper.h + test_types.cpp + test_tiffheader.cpp ) #TODO Use GTest::GTest once we upgrade the minimum CMake version required -target_link_libraries(unit_tests +target_link_libraries(unit_tests PRIVATE exiv2lib ${GTEST_BOTH_LIBRARIES} @@ -13,6 +14,7 @@ target_link_libraries(unit_tests target_include_directories(unit_tests PRIVATE ${GTEST_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/src ) target_compile_definitions(unit_tests diff --git a/unitTests/test_tiffheader.cpp b/unitTests/test_tiffheader.cpp new file mode 100644 index 00000000..8afa721e --- /dev/null +++ b/unitTests/test_tiffheader.cpp @@ -0,0 +1,22 @@ +#include + +#include "gtestwrapper.h" +#include + +using namespace Exiv2; + +static const byte tiffLittleEndian[] = {0x49, 0x49, 0x2a, 0x00, 0x10, 0x00, 0x00, 0x00}; + +class ATiffHeader: public ::testing::Test +{ +public: + Internal::TiffHeader header; +}; + +TEST_F(ATiffHeader, hasExpectedValuesAfterCreation) +{ + ASSERT_EQ(8u, header.size()); + ASSERT_EQ(42, header.tag()); + ASSERT_EQ(8u, header.offset()); + ASSERT_EQ(littleEndian, header.byteOrder()); +}