Commit Graph

39 Commits

Author SHA1 Message Date
Luis Díaz Más 94375034e6 Fix -Wsign-compare issues 2018-09-12 19:22:31 +02:00
Luis Díaz Más 24be5a514e [Appveyor] Build exiv2 with Visual Studio 2012 and 2013
- Integration tests had to be disabled with 2012 and 2013. There were
few (4) tests failing for these cases.
- Only bring libiconv with conan when a windows subsystem is detected.
- libiconv can be enabled now with a conan option.
- Use infinity instead of INFINITY
- Use conan_basic_setup(). Fixes a problem with gtest is VS2012
- call vcvarsall.bat for each compiler version so that nmake can be
found.
2018-09-10 10:31:00 +02:00
Luis Díaz Más 4161099b91 Fix warnings reported by MSVC 2018-09-10 10:31:00 +02:00
Luis Diaz Mas 0cf7d4fad8 Add unit tests for the TimeValue class 2018-09-10 08:40:55 +02:00
Dan Čermák e705f1ef5b Add unit test for floatToRationalCast 2018-08-27 17:21:16 +02:00
Dan Čermák 2dacb19933 [safe_op] Add Safe::abs(), calculates absoulte value without UB
Add a drop-in replacement for std::abs which never produces
negative values and thereby never invokes undefined behavior.
2018-08-27 17:21:16 +02:00
Luis Diaz Mas eb306fdbae Substitute malloc/free with new/delete 2018-08-27 13:24:47 +02:00
Luis Diaz Mas 669ab49c43 New tests for Uri class 2018-08-27 13:24:47 +02:00
Luis Diaz Mas ca290d870f New tests for base64 encode & decode 2018-08-27 13:24:47 +02:00
Luis Diaz Mas 5d76036af5 Add more tests for decoding and encoding URL functions 2018-08-27 13:24:47 +02:00
Luis Diaz Mas 0bc6fbcea7 Add stdexcept header in unit test files 2018-08-26 15:46:47 +02:00
Luis Diaz Mas ad004498a2 Cleanup 'comparison between signed & unsigned integer' warning 2018-08-24 16:45:52 +02:00
Dan Čermák 088986e5fa [unit_tests] Remove a memory leak from test_XmpKey.cpp
XmpProperties::registerNs allocates strings on the heap that must be freed
manually via XmpProperties::unregisterNs().
=> do this in TearDownTestCase()
2018-05-27 12:11:30 +02:00
Dan Čermák dd52b1a832 Add helper_functions.cpp/hpp & unit tests
- add function which constructs a new std::string from a potentially not null
  terminated char *
- add unit tests
2018-05-27 09:38:27 +02:00
Luis Diaz Mas 4713336c93 Add more unit tests for TiffHeader 2018-05-26 18:19:40 +02:00
Luis Diaz Mas 59493d1edc Fix bug in Cr2Header::read 2018-05-26 18:19:40 +02:00
Luis Diaz Mas b1c34ee11f Add unit tests for Cr2Header 2018-05-26 18:19:40 +02:00
Luis Díaz Más 794fea2639 Replaced way to check buffer after calling DateValue::copy 2018-04-08 10:10:12 +02:00
Luis Diaz Mas bf0b7affaa Add few basic unit tests for DateValue
I feel more confortable doing changes in a code that I do not know by
having some unit tests around it. These characterisation tests will
also be useful as documentation.
2018-04-08 10:10:12 +02:00
Luis Díaz Más b545605d25 Add characterisation tests for XmpKey 2018-04-07 20:04:22 +02:00
Dan Čermák 8b7941b733 [cmake] Add EXTRA_COMPILE_FLAGS to samples & unitTests
Add the additional compiler flags added by -DEXIV2_TEAM_EXTRA_WARNINGS=ON to
the targets in samples/ & unitTests/
This fixes #204
2018-03-29 13:17:24 +02:00
Dan Čermák 842dd4cecc Add a unit tests for enforce() 2018-03-25 23:25:23 +02:00
Dan Čermák 06ec1e6984 [safe_op] Refactored addition overflow checks using functions only
- templated structs were not required, SFINAE works for functions too
  => use instead, removes some unneeded code
- fix non-usage of builtins with clang
- adjust unit tests
2018-03-09 00:14:24 +01:00
Dan Čermák 1de633ad37 Reset errno to 0 before unit test probing strerror(errno)
errno can be set to a non-zero value from a previously failed system
call, it is not reset by successful ones
=> have to do that manually or the unit test fails because it detects
   an "outdated" error message
2017-12-17 23:46:10 +01:00
Dan Čermák 3b3283e37d Added unit tests for new overflow checking addition functions 2017-12-17 20:35:07 +01:00
Luis Díaz Más 39377b8c02 Fix strError tests on Mac 2017-12-17 18:26:12 +01:00
Luis Díaz Más 9b463708a4 Test runner return the gtest return value 2017-12-17 18:26:12 +01:00
Luis Díaz Más f36bea3801 exiv2::getEnv throws std::out_of_range on unexpected EnVar
This change define explicitly the behavior that exiv2::getEnv should have
on response to unexpected inputs.

There are some other minor changes:

- Use _putenv_s for the unit tests on Windows
- Add todo comment
- Remove deprecated note about freeing memory
2017-12-06 17:29:05 +01:00
Luis Díaz Más 8b049922d7 Change exiv2::urlencode signature to return std::string
The goal of this change is to remove the responsibility from the client code to
free the memory of the returned string.
2017-12-06 17:29:05 +01:00
Luis Díaz Más fd5f131f4e Add characterisation test for exiv2::urlencode 2017-12-06 17:29:05 +01:00
Luis Díaz Más 171c7970f9 Add characterization tests for exiv2::getEnv 2017-12-06 17:29:05 +01:00
Luis Diaz Mas ec09c98adb add few characterisation tests for exiv2::strError 2017-12-06 17:29:05 +01:00
Luis Díaz Más cc7ff4122d Export all symbols when running unit tests. Add dummy test for private code.
I tried to use directly the private OBJECT library (exiv2lib_int) in the unit_tests targets, but the private objects have dependencies on the public symbols (circular dependency)
and therefore it is impossible to test the private code with that approach with the current design of the library.

Starting from CMake 3.3 we can use the variable CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS to export all the symbols of a shared library:
https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/

Even having the opportunity to use this variable (that will be only used when EXIV2_BUILD_UNIT_TESTS is enabled) the previous commits are still valid.
It is interesting to clearly differentiate between the public and private code of the library. Enforcing this, make us think twice before putting code in the public
part of the library.
2017-11-28 17:36:08 +01:00
Luis Díaz Más cfe614d8c3 Provide a gtestWrapper header to skip useless warnings 2017-11-25 08:33:15 +01:00
Luis Diaz Mas 2e8376dccc Do not use Gtest imported target (Not available in minimum CMake version required) 2017-10-16 07:27:32 +02:00
Luis Díaz Más 752e7a6bea Add simple unit tests for DataBuf 2017-10-16 07:27:32 +02:00
Luis Díaz Más 72cf9166fe Add simple tests for exifTime 2017-10-16 07:27:32 +02:00
Luis Díaz Más 2bad771834 (CMake) Add GTEST_LINKED_AS_SHARED_LIBRARY definition 2017-10-16 07:27:32 +02:00
Luis Díaz Más 26189ad287 (CMake) Add a new CMake option to enable the new Unit Tests 2017-10-16 07:27:32 +02:00