Some tidying up.
[libdcp.git] / test / frame_info_test.cc
index 8f883f68b9416087e4856f1bc56b39af6819d3fd..02ff83aa59ebba64df2e555f5a7daea8f9371006 100644 (file)
 
 #include <fstream>
 #include <boost/test/unit_test.hpp>
-#include "picture_asset_writer.h"
+#include "picture_mxf.h"
+#include "picture_mxf_writer.h"
 
 using namespace std;
 
-/* Test writing of frame_info_test with fstream and stdio */
+/* Test writing and reading of frame_info_test with fstream and stdio */
 BOOST_AUTO_TEST_CASE (frame_info_test)
 {
-       libdcp::FrameInfo a (8589934592, 17179869184, "thisisahash");
+       dcp::FrameInfo a (8589934592LL, 17179869184LL, "thisisahash");
 
        ofstream o1 ("build/test/frame_info1");
        a.write (o1);
@@ -46,4 +47,15 @@ BOOST_AUTO_TEST_CASE (frame_info_test)
        getline (c2, s2);
 
        BOOST_CHECK_EQUAL (s1, s2);
+
+       ifstream l1 ("build/test/frame_info1");
+       dcp::FrameInfo b1 (l1);
+
+       FILE* l2 = fopen ("build/test/frame_info2", "r");
+       BOOST_CHECK (l2);
+       dcp::FrameInfo b2 (l2);
+
+       BOOST_CHECK_EQUAL (b1.offset, b2.offset);
+       BOOST_CHECK_EQUAL (b1.size, b2.size);
+       BOOST_CHECK_EQUAL (b1.hash, b2.hash);
 }