diff options
Diffstat (limited to 'libtmdb')
-rw-r--r-- | libtmdb/Jamfile.jam | 3 | ||||
-rw-r--r-- | libtmdb/testModels.cpp | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/libtmdb/Jamfile.jam b/libtmdb/Jamfile.jam index 8b6d246..bbdb3b6 100644 --- a/libtmdb/Jamfile.jam +++ b/libtmdb/Jamfile.jam @@ -34,9 +34,12 @@ lib tmdb : <library>pthread ; +path-constant me : . ; + unit-test testModels : [ glob testModels.cpp ] : + <define>ROOT=\"$(me)\" <define>BOOST_TEST_DYN_LINK <library>boost_utf <library>tmdb diff --git a/libtmdb/testModels.cpp b/libtmdb/testModels.cpp index fe2dbab..fac4e65 100644 --- a/libtmdb/testModels.cpp +++ b/libtmdb/testModels.cpp @@ -14,9 +14,13 @@ namespace std { } }; +#define XSTR(s) STR(s) +#define STR(s) #s +const boost::filesystem::path root(XSTR(ROOT)); + BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json ) { - auto results = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::SearchMultiResults>("samples/searchMulti_breakingBad.json"); + auto results = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::SearchMultiResults>((root / "samples" / "searchMulti_breakingBad.json").string()); BOOST_REQUIRE_EQUAL(1, results->Page); BOOST_REQUIRE_EQUAL(1, results->TotalPages); BOOST_REQUIRE_EQUAL(3, results->TotalResults); @@ -41,7 +45,7 @@ BOOST_AUTO_TEST_CASE( deserialize_searchmulti_json ) BOOST_AUTO_TEST_CASE( deserialize_movie_json ) { - auto movie = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::Movie>("samples/movie_550.json"); + auto movie = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::Movie>((root / "samples" / "movie_550.json").string()); BOOST_REQUIRE_EQUAL(550, movie->Id); BOOST_REQUIRE_EQUAL(false, movie->Adult); BOOST_REQUIRE_EQUAL("/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg", movie->BackdropPath); @@ -76,7 +80,7 @@ BOOST_AUTO_TEST_CASE( deserialize_movie_json ) BOOST_AUTO_TEST_CASE( deserialize_tvseries_json ) { - auto tvSeries = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::TvSeries>("samples/tv_1396.json"); + auto tvSeries = Slicer::Deserialize<Slicer::JsonFileDeserializer, TMDb::TvSeries>((root / "samples" / "tv_1396.json").string()); BOOST_REQUIRE_EQUAL("/sIJyCJedGlZf1TId41gCtkblBGo.jpg", tvSeries->BackdropPath); BOOST_REQUIRE_EQUAL(1, tvSeries->CreatedBy.size()); BOOST_REQUIRE_EQUAL(66633, tvSeries->CreatedBy.front().Id); |