Skip to content

Commit 72466a0

Browse files
committed
replace boost::unittest with OIIO::unittest
Signed-off-by: Anton Dukhovnikov <[email protected]>
1 parent c64bffd commit 72466a0

File tree

16 files changed

+515
-413
lines changed

16 files changed

+515
-413
lines changed

build_scripts/install_deps.bash

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,4 @@ time sudo apt-get update
99
time sudo apt-get -q -f install -y \
1010
libunwind-dev libilmbase-dev libopenexr-dev \
1111
libopenimageio-dev \
12-
libboost-dev libboost-thread-dev libboost-filesystem-dev \
13-
libboost-test-dev \
1412
libraw-dev libceres-dev nlohmann-json-dev

build_scripts/install_deps_linux.bash

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ time sudo apt-get update
77
time sudo apt-get -q -f install -y \
88
libunwind-dev \
99
libimath-dev libopenexr-dev \
10-
libboost-dev libboost-filesystem-dev \
11-
libboost-test-dev \
1210
libraw-dev libceres-dev \
1311
libopencv-dev \
1412
openimageio-tools \

build_scripts/install_deps_mac.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
set -ex
44

5-
brew install ceres-solver imath openexr libraw boost openimageio nlohmann-json
5+
brew install ceres-solver imath openexr libraw openimageio nlohmann-json

build_scripts/install_deps_windows.bash

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,4 @@ vcpkg install \
77
ceres:x64-windows \
88
imath:x64-windows \
99
openimageio:x64-windows \
10-
boost-system:x64-windows \
11-
boost-foreach:x64-windows \
12-
boost-filesystem:x64-windows \
13-
boost-test:x64-windows \
14-
boost-property-tree:x64-windows \
1510
nlohmann-json:x64-windows

configure.cmake

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ find_package ( Eigen3 CONFIG REQUIRED )
99
find_package ( Imath CONFIG REQUIRED )
1010
find_package ( nlohmann_json CONFIG REQUIRED )
1111
find_package ( Ceres REQUIRED )
12-
find_package ( Boost REQUIRED
13-
COMPONENTS
14-
system
15-
filesystem
16-
unit_test_framework
17-
)
1812

1913
find_package (libraw CONFIG QUIET )
2014

src/rawtoaces_idt/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ target_link_libraries(
1919
PUBLIC
2020
Eigen3::Eigen
2121
PRIVATE
22-
Boost::boost
23-
Boost::system
2422
nlohmann_json::nlohmann_json
2523
)
2624

src/rawtoaces_util/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ target_link_libraries ( ${RAWTOACESLIB}
2222
PUBLIC
2323
${RAWTOACESIDTLIB}
2424
PRIVATE
25-
Boost::filesystem
2625
Imath::Imath
2726
Imath::ImathConfig
2827
)

src/rawtoaces_util/acesrender.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@
5656
#include <rawtoaces/mathOps.h>
5757

5858
#include <Imath/half.h>
59-
#include <boost/property_tree/ptree.hpp>
60-
#include <boost/property_tree/json_parser.hpp>
61-
#include <boost/foreach.hpp>
59+
#include <nlohmann/json.hpp>
6260

6361
#include <aces/aces_Writer.h>
6462

@@ -68,9 +66,9 @@
6866
#endif
6967

7068
using namespace std;
71-
using namespace boost::property_tree;
7269

73-
#include <boost/filesystem.hpp>
70+
#include <filesystem>
71+
#include <mutex>
7472

7573
// =====================================================================
7674
// Prepare the matching between string flags and single character flag
@@ -732,9 +730,9 @@ void AcesRender::gatherSupportedIllums()
732730
string path( *file );
733731
try
734732
{
735-
ptree pt;
736-
read_json( path, pt );
737-
string tmp = pt.get<string>( "header.illuminant" );
733+
std::ifstream i( path );
734+
nlohmann::json data = nlohmann::json::parse( i );
735+
const string tmp = data["header"]["illuminant"];
738736

739737
if ( record.find( tmp ) != record.end() )
740738
continue;
@@ -780,10 +778,11 @@ void AcesRender::gatherSupportedCameras()
780778
string path( *file );
781779
try
782780
{
783-
ptree pt;
784-
read_json( path, pt );
785-
string tmp = pt.get<string>( "header.manufacturer" );
786-
tmp += ( " / " + pt.get<string>( "header.model" ) );
781+
std::ifstream i( path );
782+
nlohmann::json data = nlohmann::json::parse( i );
783+
const string make = data["header"]["manufacturer"];
784+
const string model = data["header"]["model"];
785+
string tmp = make + "/" + model;
787786

788787
if ( record.find( tmp ) != record.end() )
789788
continue;
@@ -1004,7 +1003,7 @@ vector<string> findFiles( string filePath, vector<string> searchPaths )
10041003
{
10051004
string path = i + "/" + filePath;
10061005

1007-
if ( boost::filesystem::exists( path ) )
1006+
if ( std::filesystem::exists( path ) )
10081007
foundFiles.push_back( path );
10091008
}
10101009

unittest/CMakeLists.txt

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
add_definitions (-DBOOST_TEST_DYN_LINK)
43

54
add_executable (
65
Test_Spst
@@ -13,9 +12,7 @@ target_link_libraries(
1312
Test_Spst
1413
PUBLIC
1514
${RAWTOACESLIB}
16-
Boost::boost
17-
Boost::filesystem
18-
Boost::unit_test_framework
15+
OpenImageIO::OpenImageIO
1916
)
2017

2118
add_executable (
@@ -29,11 +26,7 @@ target_link_libraries(
2926
Test_IDT
3027
PUBLIC
3128
${RAWTOACESLIB}
32-
Imath::Imath
33-
Imath::ImathConfig
34-
Boost::boost
35-
Boost::filesystem
36-
Boost::unit_test_framework
29+
OpenImageIO::OpenImageIO
3730
)
3831

3932
add_executable (
@@ -47,9 +40,7 @@ target_link_libraries(
4740
Test_Illum
4841
PUBLIC
4942
${RAWTOACESLIB}
50-
Boost::boost
51-
Boost::filesystem
52-
Boost::unit_test_framework
43+
OpenImageIO::OpenImageIO
5344
)
5445

5546
add_executable (
@@ -63,9 +54,7 @@ target_link_libraries(
6354
Test_DNGIdt
6455
PUBLIC
6556
${RAWTOACESLIB}
66-
Boost::boost
67-
Boost::filesystem
68-
Boost::unit_test_framework
57+
OpenImageIO::OpenImageIO
6958
)
7059

7160
if ( LIBRAW_CONFIG_FOUND )
@@ -87,9 +76,7 @@ target_link_libraries(
8776
Test_Math
8877
PUBLIC
8978
${RAWTOACESLIB}
90-
Boost::boost
91-
Boost::filesystem
92-
Boost::unit_test_framework
79+
OpenImageIO::OpenImageIO
9380
)
9481

9582
add_executable (
@@ -103,9 +90,7 @@ target_link_libraries(
10390
Test_Logic
10491
PUBLIC
10592
${RAWTOACESLIB}
106-
Boost::boost
107-
Boost::filesystem
108-
Boost::unit_test_framework
93+
OpenImageIO::OpenImageIO
10994
)
11095

11196
add_executable (
@@ -119,9 +104,7 @@ target_link_libraries(
119104
Test_Misc
120105
PUBLIC
121106
${RAWTOACESLIB}
122-
Boost::boost
123-
Boost::filesystem
124-
Boost::unit_test_framework
107+
OpenImageIO::OpenImageIO
125108
)
126109

127110

unittest/testDNGIdt.cpp

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@
5252
// THAN A.M.P.A.S., WHETHER DISCLOSED OR UNDISCLOSED.
5353
///////////////////////////////////////////////////////////////////////////
5454

55-
#define BOOST_TEST_MAIN
56-
#include <boost/test/unit_test.hpp>
57-
#include <boost/filesystem.hpp>
58-
#include <boost/test/floating_point_comparison.hpp>
55+
#include <OpenImageIO/unittest.h>
5956

6057
#include <libraw/libraw.h>
6158

@@ -65,18 +62,18 @@
6562
using namespace std;
6663
using namespace rta;
6764

68-
BOOST_AUTO_TEST_CASE( TestIDT_CcttoMired )
65+
void testIDT_CcttoMired()
6966
{
7067

7168
DNGIdt *di = new DNGIdt();
7269
double cct = 6500.0;
7370
double mired = di->ccttoMired( cct );
7471
delete di;
7572

76-
BOOST_CHECK_CLOSE( mired, 153.8461538462, 1e-5 );
73+
OIIO_CHECK_EQUAL_THRESH( mired, 153.8461538462, 1e-5 );
7774
};
7875

79-
BOOST_AUTO_TEST_CASE( TestIDT_RobertsonLength )
76+
void testIDT_RobertsonLength()
8077
{
8178

8279
DNGIdt *di = new DNGIdt();
@@ -88,12 +85,12 @@ BOOST_AUTO_TEST_CASE( TestIDT_RobertsonLength )
8885
double rLength = di->robertsonLength( uvVector, uvtVector );
8986
delete di;
9087

91-
BOOST_CHECK_CLOSE( rLength, 0.060234937, 1e-5 );
88+
OIIO_CHECK_EQUAL_THRESH( rLength, 0.060234937, 1e-5 );
9289
};
9390

9491
DNGIdt *openFile( std::string path, LibRaw &rawProcessor )
9592
{
96-
boost::filesystem::path pathToRaw = boost::filesystem::absolute(
93+
std::filesystem::path pathToRaw = std::filesystem::absolute(
9794
"../../unittest/materials/blackmagic_cinema_camera_cinemadng.dng" );
9895
int ret = rawProcessor.open_file( ( pathToRaw.string() ).c_str() );
9996
ret = rawProcessor.unpack();
@@ -140,17 +137,17 @@ DNGIdt *openFile( std::string path, LibRaw &rawProcessor )
140137
return new DNGIdt( metadata );
141138
}
142139

143-
BOOST_AUTO_TEST_CASE( TestIDT_LightSourceToColorTemp )
140+
void testIDT_LightSourceToColorTemp()
144141
{
145142
DNGIdt *di = new DNGIdt();
146143
unsigned short tag = 17;
147144
double ct = di->lightSourceToColorTemp( tag );
148145
delete di;
149146

150-
BOOST_CHECK_CLOSE( ct, 2856.0, 1e-5 );
147+
OIIO_CHECK_EQUAL_THRESH( ct, 2856.0, 1e-5 );
151148
};
152149

153-
BOOST_AUTO_TEST_CASE( TestIDT_XYZToColorTemperature )
150+
void testIDT_XYZToColorTemperature()
154151
{
155152
LibRaw rawProcessor;
156153
DNGIdt *di = openFile(
@@ -163,10 +160,10 @@ BOOST_AUTO_TEST_CASE( TestIDT_XYZToColorTemperature )
163160
rawProcessor.recycle();
164161
delete di;
165162

166-
BOOST_CHECK_CLOSE( cct, 5564.6648479019, 1e-5 );
163+
OIIO_CHECK_EQUAL_THRESH( cct, 5564.6648479019, 1e-5 );
167164
};
168165

169-
BOOST_AUTO_TEST_CASE( TestIDT_XYZtoCameraWeightedMatrix )
166+
void testIDT_XYZtoCameraWeightedMatrix()
170167
{
171168
LibRaw rawProcessor;
172169
DNGIdt *di = openFile(
@@ -183,10 +180,10 @@ BOOST_AUTO_TEST_CASE( TestIDT_XYZtoCameraWeightedMatrix )
183180
delete di;
184181

185182
FORI( countSize( matrix ) )
186-
BOOST_CHECK_CLOSE( result[i], matrix[i], 1e-5 );
183+
OIIO_CHECK_EQUAL_THRESH( result[i], matrix[i], 1e-5 );
187184
};
188185

189-
BOOST_AUTO_TEST_CASE( TestIDT_FindXYZtoCameraMtx )
186+
void testIDT_FindXYZtoCameraMtx()
190187
{
191188
LibRaw rawProcessor;
192189
DNGIdt *di = openFile(
@@ -204,10 +201,10 @@ BOOST_AUTO_TEST_CASE( TestIDT_FindXYZtoCameraMtx )
204201
delete di;
205202

206203
FORI( countSize( matrix ) )
207-
BOOST_CHECK_CLOSE( result[i], matrix[i], 1e-5 );
204+
OIIO_CHECK_EQUAL_THRESH( result[i], matrix[i], 1e-5 );
208205
};
209206

210-
BOOST_AUTO_TEST_CASE( TestIDT_ColorTemperatureToXYZ )
207+
void testIDT_ColorTemperatureToXYZ()
211208
{
212209

213210
DNGIdt *di = new DNGIdt();
@@ -217,10 +214,10 @@ BOOST_AUTO_TEST_CASE( TestIDT_ColorTemperatureToXYZ )
217214
delete di;
218215

219216
FORI( countSize( XYZ ) )
220-
BOOST_CHECK_CLOSE( result[i], XYZ[i], 1e-5 );
217+
OIIO_CHECK_EQUAL_THRESH( result[i], XYZ[i], 1e-5 );
221218
};
222219

223-
BOOST_AUTO_TEST_CASE( TestIDT_MatrixRGBtoXYZ )
220+
void testIDT_MatrixRGBtoXYZ()
224221
{
225222

226223
DNGIdt *di = new DNGIdt();
@@ -231,10 +228,10 @@ BOOST_AUTO_TEST_CASE( TestIDT_MatrixRGBtoXYZ )
231228
delete di;
232229

233230
FORI( countSize( XYZ ) )
234-
BOOST_CHECK_CLOSE( result[i], XYZ[i], 1e-5 );
231+
OIIO_CHECK_EQUAL_THRESH( result[i], XYZ[i], 1e-5 );
235232
};
236233

237-
BOOST_AUTO_TEST_CASE( TestIDT_GetDNGCATMatrix )
234+
void testIDT_GetDNGCATMatrix()
238235
{
239236
LibRaw rawProcessor;
240237
DNGIdt *di = openFile(
@@ -250,10 +247,10 @@ BOOST_AUTO_TEST_CASE( TestIDT_GetDNGCATMatrix )
250247
delete di;
251248

252249
FORIJ( 3, 3 )
253-
BOOST_CHECK_CLOSE( result[i][j], matrix[i][j], 1e-5 );
250+
OIIO_CHECK_EQUAL_THRESH( result[i][j], matrix[i][j], 1e-5 );
254251
};
255252

256-
BOOST_AUTO_TEST_CASE( TestIDT_GetDNGIDTMatrix )
253+
void testIDT_GetDNGIDTMatrix()
257254
{
258255
LibRaw rawProcessor;
259256
DNGIdt *di = openFile(
@@ -269,5 +266,21 @@ BOOST_AUTO_TEST_CASE( TestIDT_GetDNGIDTMatrix )
269266
delete di;
270267

271268
FORIJ( 3, 3 )
272-
BOOST_CHECK_CLOSE( result[i][j], matrix[i][j], 1e-5 );
269+
OIIO_CHECK_EQUAL_THRESH( result[i][j], matrix[i][j], 1e-5 );
273270
};
271+
272+
int main( int, char ** )
273+
{
274+
testIDT_CcttoMired();
275+
testIDT_RobertsonLength();
276+
testIDT_LightSourceToColorTemp();
277+
testIDT_XYZToColorTemperature();
278+
testIDT_XYZtoCameraWeightedMatrix();
279+
testIDT_FindXYZtoCameraMtx();
280+
testIDT_ColorTemperatureToXYZ();
281+
testIDT_MatrixRGBtoXYZ();
282+
testIDT_GetDNGCATMatrix();
283+
testIDT_GetDNGIDTMatrix();
284+
285+
return unit_test_failures;
286+
}

0 commit comments

Comments
 (0)