diff options
author | Hubert Figuière <hub@figuiere.net> | 2022-02-13 12:35:42 -0500 |
---|---|---|
committer | Hubert Figuière <hub@figuiere.net> | 2022-02-13 12:35:42 -0500 |
commit | 0ac0675dcd41cf44dfee36216e032bcc46cfd9f3 (patch) | |
tree | 9fa10511e5914f9e223b2fee129b99e6a1cae9cb | |
parent | b75727d30b51ad2d51f9124732f5b45f638bddf1 (diff) |
Issue #24 - Remove boost_test_minimal
- Bump requirement to boost 1.60
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | exempi/tests/test-bgo.cpp | 20 | ||||
-rw-r--r-- | exempi/tests/test-exempi-core.cpp | 12 | ||||
-rw-r--r-- | exempi/tests/test-fdo83313.cpp | 16 | ||||
-rw-r--r-- | exempi/tests/test-iterator.cpp | 12 | ||||
-rw-r--r-- | exempi/tests/test-serialise.cpp | 15 | ||||
-rw-r--r-- | exempi/tests/test-tiff-leak.cpp | 15 | ||||
-rw-r--r-- | exempi/tests/test-webp.cpp | 21 | ||||
-rw-r--r-- | exempi/tests/test-write-new-prop.cpp | 16 | ||||
-rw-r--r-- | exempi/tests/test-xmpfiles-write.cpp | 21 | ||||
-rw-r--r-- | exempi/tests/test-xmpfiles.cpp | 15 | ||||
-rw-r--r-- | exempi/tests/test-xmpformat.cpp | 13 | ||||
-rw-r--r-- | exempi/tests/testcpp.cpp | 12 | ||||
-rw-r--r-- | exempi/tests/testinit.cpp | 12 | ||||
-rw-r--r-- | exempi/tests/testparse.cpp | 15 |
15 files changed, 120 insertions, 97 deletions
diff --git a/configure.ac b/configure.ac index e6457e6..5663f8d 100644 --- a/configure.ac +++ b/configure.ac @@ -180,7 +180,7 @@ AC_ARG_ENABLE(unittest, ENABLE_UNITTEST=$enableval, ENABLE_UNITTEST=yes) if test x$ENABLE_UNITTEST = xyes ; then - BOOST_REQUIRE([1.48.0]) + BOOST_REQUIRE([1.60.0]) BOOST_TEST([mt-s]) else ENABLE_UNITTEST=no diff --git a/exempi/tests/test-bgo.cpp b/exempi/tests/test-bgo.cpp index 1919780..3058951 100644 --- a/exempi/tests/test-bgo.cpp +++ b/exempi/tests/test-bgo.cpp @@ -1,7 +1,7 @@ /* * exempi - test-bgo.cpp * - * Copyright (C) 2007-2008 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,28 +40,33 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmpconsts.h" #include "xmp.h" -int test_main(int argc, char* argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "fdo18635.jpg"); + return nullptr; +} + +BOOST_AUTO_TEST_CASE(test_bgo) +{ BOOST_CHECK(xmp_init()); XmpFilePtr xf = xmp_files_open_new(g_testfile.c_str(), XMP_OPEN_READ); - BOOST_CHECK(xf != NULL); - if (xf == NULL) { - return 1; + BOOST_CHECK(xf != nullptr); + if (xf == nullptr) { + return; } XmpPtr xmp = xmp_files_get_new_xmp(xf); - BOOST_CHECK(xmp != NULL); + BOOST_CHECK(xmp != nullptr); BOOST_CHECK(xmp_free(xmp)); BOOST_CHECK(xmp_files_free(xf)); @@ -70,5 +75,4 @@ int test_main(int argc, char* argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/test-exempi-core.cpp b/exempi/tests/test-exempi-core.cpp index 8f48aa9..e9ee5dd 100644 --- a/exempi/tests/test-exempi-core.cpp +++ b/exempi/tests/test-exempi-core.cpp @@ -1,7 +1,7 @@ /* * exempi - test-exempi-core.cpp * - * Copyright (C) 2007-2013 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,7 +40,7 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmpconsts.h" @@ -48,11 +48,14 @@ using boost::unit_test::test_suite; -// void test_exempi() -int test_main(int argc, char *argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "test1.xmp"); + return nullptr; +} +BOOST_AUTO_TEST_CASE(test_exempi_core) +{ size_t len; char *buffer; @@ -231,5 +234,4 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/test-fdo83313.cpp b/exempi/tests/test-fdo83313.cpp index 38ff771..4a1eba8 100644 --- a/exempi/tests/test-fdo83313.cpp +++ b/exempi/tests/test-fdo83313.cpp @@ -1,7 +1,7 @@ /* - * exempi - test-bgo.cpp + * exempi - test-fd083313.cpp * - * Copyright (C) 2007-2008 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,23 +40,28 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmpconsts.h" #include "xmp.h" -int test_main(int argc, char* argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "fdo83313.jpg"); + return nullptr; +} + +BOOST_AUTO_TEST_CASE(test_fd083313) +{ BOOST_CHECK(xmp_init()); XmpFilePtr xf = xmp_files_open_new(g_testfile.c_str(), XMP_OPEN_READ); BOOST_CHECK(xf != NULL); if (xf == NULL) { - return 1; + exit(128); } XmpPtr xmp = xmp_files_get_new_xmp(xf); @@ -70,5 +75,4 @@ int test_main(int argc, char* argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/test-iterator.cpp b/exempi/tests/test-iterator.cpp index 93ea189..971fd44 100644 --- a/exempi/tests/test-iterator.cpp +++ b/exempi/tests/test-iterator.cpp @@ -1,7 +1,7 @@ /* * exempi - test3.cpp * - * Copyright (C) 2007-2017 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #include <string> #include <vector> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include <boost/format.hpp> #include "utils.h" @@ -52,11 +52,14 @@ using boost::unit_test::test_suite; -// void test_exempi_iterate() -int test_main(int argc, char *argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "test1.xmp"); + return nullptr; +} +BOOST_AUTO_TEST_CASE(test_exempi_iterate) +{ size_t len; char *buffer; @@ -170,5 +173,4 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/test-serialise.cpp b/exempi/tests/test-serialise.cpp index 6175a16..a9be73a 100644 --- a/exempi/tests/test-serialise.cpp +++ b/exempi/tests/test-serialise.cpp @@ -1,7 +1,7 @@ /* * exempi - test-serialise.cpp * - * Copyright (C) 2007-2008 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,19 +40,21 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmpconsts.h" #include "xmp.h" -using boost::unit_test::test_suite; - -// void test_serialize() -int test_main(int argc, char *argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "test1.xmp"); + return nullptr; +} + +BOOST_AUTO_TEST_CASE(test_serialise) +{ size_t len; char *buffer; FILE *f = fopen(g_testfile.c_str(), "rb"); @@ -98,5 +100,4 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/test-tiff-leak.cpp b/exempi/tests/test-tiff-leak.cpp index 729cced..91402e7 100644 --- a/exempi/tests/test-tiff-leak.cpp +++ b/exempi/tests/test-tiff-leak.cpp @@ -1,7 +1,7 @@ /* * exempi - test-tiff-leak.cpp * - * Copyright (C) 2007-2008,2010 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,7 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmp.h" @@ -49,11 +49,15 @@ /** See http://www.adobeforums.com/webx/.3bc42b73 for the orignal * test case */ -// void test_tiff_leak() -int test_main(int argc, char *argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "../../samples/testfiles/BlueSquare.jpg"); + return nullptr; +} + +BOOST_AUTO_TEST_CASE(test_tiff_leak) +{ std::string orig_tiff_file = g_src_testdir + "../../samples/testfiles/BlueSquare.tif"; BOOST_CHECK(copy_file(orig_tiff_file, "test.tif")); @@ -64,7 +68,7 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(f != NULL); if (f == NULL) { - return 1; + exit(128); } XmpPtr xmp; @@ -82,5 +86,4 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(unlink("test.tif") == 0); BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/test-webp.cpp b/exempi/tests/test-webp.cpp index 47aa7dc..3151f24 100644 --- a/exempi/tests/test-webp.cpp +++ b/exempi/tests/test-webp.cpp @@ -1,7 +1,7 @@ /* * exempi - test-webp.cpp * - * Copyright (C) 2007-2016 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,19 +41,20 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmp.h" #include "xmpconsts.h" -using boost::unit_test::test_suite; - - -int test_main(int argc, char *argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "../../samples/testfiles/BlueSquare.webp"); + return nullptr; +} +BOOST_AUTO_TEST_CASE(test_webp) +{ BOOST_CHECK(xmp_init()); BOOST_CHECK(xmp_files_check_file_format(g_testfile.c_str()) == XMP_FT_WEBP); @@ -61,7 +62,7 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(f != NULL); if (f == NULL) { - return 1; + exit(128); } XmpPtr xmp = xmp_files_get_new_xmp(f); @@ -78,7 +79,7 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(f != NULL); if (f == NULL) { - return 2; + exit(128); } BOOST_CHECK(xmp_set_property(xmp, NS_PHOTOSHOP, "ICCProfile", "foo", 0)); @@ -94,7 +95,7 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(f != NULL); if (f == NULL) { - return 3; + exit(128); } xmp = xmp_files_get_new_xmp(f); BOOST_CHECK(xmp != NULL); @@ -114,6 +115,4 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - - return 0; } diff --git a/exempi/tests/test-write-new-prop.cpp b/exempi/tests/test-write-new-prop.cpp index 524376e..2982318 100644 --- a/exempi/tests/test-write-new-prop.cpp +++ b/exempi/tests/test-write-new-prop.cpp @@ -1,7 +1,7 @@ /* - * exempi - test1.cpp + * exempi - test-write-new-prop.cpp * - * Copyright (C) 2007-2008 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,19 +40,20 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmpconsts.h" #include "xmp.h" -using boost::unit_test::test_suite; - -// void test_write_new_property() -int test_main(int argc, char *argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "test1.xmp"); + return nullptr; +} +BOOST_AUTO_TEST_CASE(test_write_new_property) +{ size_t len; char *buffer; @@ -146,5 +147,4 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/test-xmpfiles-write.cpp b/exempi/tests/test-xmpfiles-write.cpp index e44e242..7376f07 100644 --- a/exempi/tests/test-xmpfiles-write.cpp +++ b/exempi/tests/test-xmpfiles-write.cpp @@ -1,7 +1,7 @@ /* * exempi - test-xmpfile-write.cpp * - * Copyright (C) 2007-2008,2010 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,19 +41,20 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmp.h" #include "xmpconsts.h" -using boost::unit_test::test_suite; - -// void test_xmpfiles_write() -int test_main(int argc, char *argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "../../samples/testfiles/BlueSquare.jpg"); + return nullptr; +} +BOOST_AUTO_TEST_CASE(test_xmpfiles_write) +{ BOOST_CHECK(xmp_init()); BOOST_CHECK(xmp_files_check_file_format(g_testfile.c_str()) == XMP_FT_JPEG); @@ -61,7 +62,7 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(f != NULL); if (f == NULL) { - return 1; + exit(128); } XmpPtr xmp = xmp_files_get_new_xmp(f); @@ -78,7 +79,7 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(f != NULL); if (f == NULL) { - return 2; + exit(128); } BOOST_CHECK(xmp_set_property(xmp, NS_PHOTOSHOP, "ICCProfile", "foo", 0)); @@ -94,7 +95,7 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(f != NULL); if (f == NULL) { - return 3; + exit(128); } xmp = xmp_files_get_new_xmp(f); BOOST_CHECK(xmp != NULL); @@ -115,6 +116,4 @@ int test_main(int argc, char *argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - - return 0; } diff --git a/exempi/tests/test-xmpfiles.cpp b/exempi/tests/test-xmpfiles.cpp index 9a2bfca..e765e7f 100644 --- a/exempi/tests/test-xmpfiles.cpp +++ b/exempi/tests/test-xmpfiles.cpp @@ -1,7 +1,7 @@ /* * exempi - test-xmpfiles.cpp * - * Copyright (C) 2007-2016 Hubert Figuière + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,19 +41,21 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmp.h" #include "xmpconsts.h" -using boost::unit_test::test_suite; - -// void test_xmpfiles() -int test_main(int argc, char* argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "../../samples/testfiles/BlueSquare.jpg"); + return nullptr; +} + +BOOST_AUTO_TEST_CASE(test_xmpfiles) +{ BOOST_CHECK(xmp_init()); XmpFilePtr f = xmp_files_open_new(g_testfile.c_str(), XMP_OPEN_READ); @@ -125,5 +127,4 @@ int test_main(int argc, char* argv[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/test-xmpformat.cpp b/exempi/tests/test-xmpformat.cpp index af13cb1..13d4919 100644 --- a/exempi/tests/test-xmpformat.cpp +++ b/exempi/tests/test-xmpformat.cpp @@ -1,7 +1,7 @@ /* * exempi - test-xmpformat.cpp * - * Copyright (C) 2020 Hubert Figuière + * Copyright (C) 2020-2022 Hubert Figuière * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -36,7 +36,7 @@ #include <map> #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "xmp.h" @@ -65,7 +65,12 @@ const std::map<const char*, XmpFileType> FAILING_CASES = { // This test would have caught: // https://gitlab.freedesktop.org/libopenraw/exempi/-/issues/20 // -int test_main(int , char *[]) +boost::unit_test::test_suite* init_unit_test_suite(int, char **) +{ + return nullptr; +} + +BOOST_AUTO_TEST_CASE(test_xmpformat) { const char* srcdir = getenv("srcdir"); if (!srcdir) { @@ -93,6 +98,4 @@ int test_main(int , char *[]) auto xft = xmp_files_check_file_format(imagepath.c_str()); BOOST_CHECK(xft == testcase.second); } - - return 0; } diff --git a/exempi/tests/testcpp.cpp b/exempi/tests/testcpp.cpp index da4c40f..70825fd 100644 --- a/exempi/tests/testcpp.cpp +++ b/exempi/tests/testcpp.cpp @@ -1,7 +1,7 @@ /* * exempi - testcpp.cpp * - * Copyright (C) 2011 Hubert Figuiere + * Copyright (C) 2011-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,16 +34,19 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmp.h" #include "xmpconsts.h" #include "xmp++.hpp" -using boost::unit_test::test_suite; +boost::unit_test::test_suite* init_unit_test_suite(int, char **) +{ + return nullptr; +} -int test_main(int /*argc*/, char* /*argv*/ []) +BOOST_AUTO_TEST_CASE(test_cpp) { // this test is totally useless without leak checking. // but for compiling. @@ -65,5 +68,4 @@ int test_main(int /*argc*/, char* /*argv*/ []) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/testinit.cpp b/exempi/tests/testinit.cpp index 6df3053..bbd06d2 100644 --- a/exempi/tests/testinit.cpp +++ b/exempi/tests/testinit.cpp @@ -1,7 +1,7 @@ /* * exempi - testinit.cpp * - * Copyright (C) 2007 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,17 +40,20 @@ #include <string> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include "utils.h" #include "xmpconsts.h" #include "xmp.h" -// void test_exempi_init() -int test_main(int argc, char* argv[]) +boost::unit_test::test_suite* init_unit_test_suite(int argc, char * argv[]) { prepare_test(argc, argv, "test1.xmp"); + return nullptr; +} +BOOST_AUTO_TEST_CASE(test_exempi_init) +{ size_t len; char* buffer; @@ -92,5 +95,4 @@ int test_main(int argc, char* argv[]) free(buffer); BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } diff --git a/exempi/tests/testparse.cpp b/exempi/tests/testparse.cpp index 803f0df..8f47ccc 100644 --- a/exempi/tests/testparse.cpp +++ b/exempi/tests/testparse.cpp @@ -1,7 +1,7 @@ /* - * exempi - test3.cpp + * exempi - testparse.cpp * - * Copyright (C) 2007-2017 Hubert Figuiere + * Copyright (C) 2007-2022 Hubert Figuière * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,17 +40,19 @@ #include <string> #include <iostream> -#include <boost/test/minimal.hpp> +#include <boost/test/included/unit_test.hpp> #include <boost/format.hpp> #include "utils.h" #include "xmp.h" #include "xmpconsts.h" -using boost::unit_test::test_suite; +boost::unit_test::test_suite* init_unit_test_suite(int, char**) +{ + return nullptr; +} -// void test_exempi_iterate() -int test_main(int, char *[]) +BOOST_AUTO_TEST_CASE(test_parse) { char *buffer; @@ -73,5 +75,4 @@ int test_main(int, char *[]) BOOST_CHECK(!g_lt->check_leaks()); BOOST_CHECK(!g_lt->check_errors()); - return 0; } |