*/
-#include <fstream>
-#include <iostream>
-#include <boost/filesystem.hpp>
-#include <boost/algorithm/string/predicate.hpp>
-#include "format.h"
-#include "film.h"
-#include "filter.h"
-#include "job_manager.h"
-#include "util.h"
-#include "exceptions.h"
-#include "dvd.h"
-#include "delay_line.h"
-#include "image.h"
-#include "log.h"
-#include "dcp_video_frame.h"
-#include "config.h"
-#include "server.h"
-#include "cross.h"
-#include "job.h"
-#include "subtitle.h"
-#include "scaler.h"
+#include <vector>
+#include <list>
+#include <Magick++.h>
+#include <libxml++/libxml++.h>
+#include <libdcp/dcp.h>
+#include "lib/config.h"
+#include "lib/util.h"
+#include "lib/ui_signaller.h"
+#include "lib/film.h"
+#include "lib/job_manager.h"
+#include "lib/job.h"
+#include "lib/cross.h"
+#include "lib/server_finder.h"
+#include "lib/image.h"
#define BOOST_TEST_DYN_LINK
-#define BOOST_TEST_MODULE dvdomatic_test
+#define BOOST_TEST_MODULE dcpomatic_test
#include <boost/test/unit_test.hpp>
using std::string;
-using std::list;
-using std::stringstream;
using std::vector;
+using std::min;
+using std::cout;
+using std::cerr;
+using std::list;
using boost::shared_ptr;
-using boost::thread;
-void
-setup_test_config ()
+class TestUISignaller : public UISignaller
{
- Config::instance()->set_num_local_encoding_threads (1);
- Config::instance()->set_colour_lut_index (0);
- Config::instance()->set_j2k_bandwidth (200000000);
- Config::instance()->set_servers (vector<ServerDescription*> ());
- Config::instance()->set_server_port (61920);
-}
+public:
+ /* No wakes in tests: we call ui_idle ourselves */
+ void wake_ui ()
+ {
-shared_ptr<Film>
-new_test_film (string name)
-{
- string const d = String::compose ("build/test/%1", name);
- if (boost::filesystem::exists (d)) {
- boost::filesystem::remove_all (d);
}
- return shared_ptr<Film> (new Film (d, false));
-}
+};
-BOOST_AUTO_TEST_CASE (film_metadata_test)
+struct TestConfig
{
- dvdomatic_setup ();
- setup_test_config ();
+ TestConfig ()
+ {
+ dcpomatic_setup ();
- string const test_film = "build/test/film_metadata_test";
-
- if (boost::filesystem::exists (test_film)) {
- boost::filesystem::remove_all (test_film);
- }
+ Config::instance()->set_num_local_encoding_threads (1);
+ Config::instance()->set_server_port_base (61920);
+ Config::instance()->set_default_dci_metadata (DCIMetadata ());
+ Config::instance()->set_default_container (static_cast<Ratio*> (0));
+ Config::instance()->set_default_dcp_content_type (static_cast<DCPContentType*> (0));
+ Config::instance()->set_default_audio_delay (0);
- BOOST_CHECK_THROW (new Film (test_film, true), OpenFileError);
-
- shared_ptr<Film> f (new Film (test_film, false));
- BOOST_CHECK (f->format() == 0);
- BOOST_CHECK (f->dcp_content_type() == 0);
- BOOST_CHECK (f->filters ().empty());
-
- f->set_name ("fred");
- BOOST_CHECK_THROW (f->set_content ("jim"), OpenFileError);
- f->set_dcp_content_type (DCPContentType::from_pretty_name ("Short"));
- f->set_format (Format::from_nickname ("Flat"));
- f->set_left_crop (1);
- f->set_right_crop (2);
- f->set_top_crop (3);
- f->set_bottom_crop (4);
- vector<Filter const *> f_filters;
- f_filters.push_back (Filter::from_id ("pphb"));
- f_filters.push_back (Filter::from_id ("unsharp"));
- f->set_filters (f_filters);
- f->set_dcp_trim_start (42);
- f->set_dcp_trim_end (99);
- f->set_dcp_ab (true);
- f->write_metadata ();
+ ServerFinder::instance()->disable ();
- stringstream s;
- s << "diff -u test/metadata.ref " << test_film << "/metadata";
- BOOST_CHECK_EQUAL (::system (s.str().c_str ()), 0);
-
- shared_ptr<Film> g (new Film (test_film, true));
-
- BOOST_CHECK_EQUAL (g->name(), "fred");
- BOOST_CHECK_EQUAL (g->dcp_content_type(), DCPContentType::from_pretty_name ("Short"));
- BOOST_CHECK_EQUAL (g->format(), Format::from_nickname ("Flat"));
- BOOST_CHECK_EQUAL (g->crop().left, 1);
- BOOST_CHECK_EQUAL (g->crop().right, 2);
- BOOST_CHECK_EQUAL (g->crop().top, 3);
- BOOST_CHECK_EQUAL (g->crop().bottom, 4);
- vector<Filter const *> g_filters = g->filters ();
- BOOST_CHECK_EQUAL (g_filters.size(), 2);
- BOOST_CHECK_EQUAL (g_filters.front(), Filter::from_id ("pphb"));
- BOOST_CHECK_EQUAL (g_filters.back(), Filter::from_id ("unsharp"));
- BOOST_CHECK_EQUAL (g->dcp_trim_start(), 42);
- BOOST_CHECK_EQUAL (g->dcp_trim_end(), 99);
- BOOST_CHECK_EQUAL (g->dcp_ab(), true);
-
- g->write_metadata ();
- BOOST_CHECK_EQUAL (::system (s.str().c_str ()), 0);
-}
+ ui_signaller = new TestUISignaller ();
+ }
+};
-BOOST_AUTO_TEST_CASE (format_test)
-{
- Format::setup_formats ();
-
- Format const * f = Format::from_nickname ("Flat");
- BOOST_CHECK (f);
- BOOST_CHECK_EQUAL (f->ratio_as_integer(shared_ptr<const Film> ()), 185);
-
- f = Format::from_nickname ("Scope");
- BOOST_CHECK (f);
- BOOST_CHECK_EQUAL (f->ratio_as_integer(shared_ptr<const Film> ()), 239);
-}
+BOOST_GLOBAL_FIXTURE (TestConfig);
-BOOST_AUTO_TEST_CASE (util_test)
+boost::filesystem::path
+test_film_dir (string name)
{
- string t = "Hello this is a string \"with quotes\" and indeed without them";
- vector<string> b = split_at_spaces_considering_quotes (t);
- vector<string>::iterator i = b.begin ();
- BOOST_CHECK_EQUAL (*i++, "Hello");
- BOOST_CHECK_EQUAL (*i++, "this");
- BOOST_CHECK_EQUAL (*i++, "is");
- BOOST_CHECK_EQUAL (*i++, "a");
- BOOST_CHECK_EQUAL (*i++, "string");
- BOOST_CHECK_EQUAL (*i++, "with quotes");
- BOOST_CHECK_EQUAL (*i++, "and");
- BOOST_CHECK_EQUAL (*i++, "indeed");
- BOOST_CHECK_EQUAL (*i++, "without");
- BOOST_CHECK_EQUAL (*i++, "them");
+ boost::filesystem::path p;
+ p /= "build";
+ p /= "test";
+ p /= name;
+ return p;
}
-BOOST_AUTO_TEST_CASE (dvd_test)
-{
- list<DVDTitle> const t = dvd_titles ("test/dvd");
- BOOST_CHECK_EQUAL (t.size(), 3);
- list<DVDTitle>::const_iterator i = t.begin ();
-
- BOOST_CHECK_EQUAL (i->number, 1);
- BOOST_CHECK_EQUAL (i->size, 0);
- ++i;
-
- BOOST_CHECK_EQUAL (i->number, 2);
- BOOST_CHECK_EQUAL (i->size, 14);
- ++i;
-
- BOOST_CHECK_EQUAL (i->number, 3);
- BOOST_CHECK_EQUAL (i->size, 7);
-}
-
-void
-do_positive_delay_line_test (int delay_length, int block_length)
+shared_ptr<Film>
+new_test_film (string name)
{
- DelayLine d (delay_length);
- uint8_t data[block_length];
-
- int in = 0;
- int out = 0;
- int returned = 0;
- int zeros = 0;
-
- for (int i = 0; i < 64; ++i) {
- for (int j = 0; j < block_length; ++j) {
- data[j] = in;
- ++in;
- }
-
- int const a = d.feed (data, block_length);
- returned += a;
-
- for (int j = 0; j < a; ++j) {
- if (zeros < delay_length) {
- BOOST_CHECK_EQUAL (data[j], 0);
- ++zeros;
- } else {
- BOOST_CHECK_EQUAL (data[j], out & 0xff);
- ++out;
- }
- }
+ boost::filesystem::path p = test_film_dir (name);
+ if (boost::filesystem::exists (p)) {
+ boost::filesystem::remove_all (p);
}
-
- BOOST_CHECK_EQUAL (returned, 64 * block_length);
+
+ shared_ptr<Film> f = shared_ptr<Film> (new Film (p.string()));
+ f->write_metadata ();
+ return f;
}
void
-do_negative_delay_line_test (int delay_length, int block_length)
-{
- DelayLine d (delay_length);
- uint8_t data[block_length];
-
- int in = 0;
- int out = -delay_length;
- int returned = 0;
+check_file (boost::filesystem::path ref, boost::filesystem::path check)
+{
+ uintmax_t N = boost::filesystem::file_size (ref);
+ BOOST_CHECK_EQUAL (N, boost::filesystem::file_size (check));
+ FILE* ref_file = fopen (ref.c_str(), "rb");
+ BOOST_CHECK (ref_file);
+ FILE* check_file = fopen (check.c_str(), "rb");
+ BOOST_CHECK (check_file);
- for (int i = 0; i < 256; ++i) {
- for (int j = 0; j < block_length; ++j) {
- data[j] = in;
- ++in;
- }
+ int const buffer_size = 65536;
+ uint8_t* ref_buffer = new uint8_t[buffer_size];
+ uint8_t* check_buffer = new uint8_t[buffer_size];
- int const a = d.feed (data, block_length);
- returned += a;
+ while (N) {
+ uintmax_t this_time = min (uintmax_t (buffer_size), N);
+ size_t r = fread (ref_buffer, 1, this_time, ref_file);
+ BOOST_CHECK_EQUAL (r, this_time);
+ r = fread (check_buffer, 1, this_time, check_file);
+ BOOST_CHECK_EQUAL (r, this_time);
- for (int j = 0; j < a; ++j) {
- BOOST_CHECK_EQUAL (data[j], out & 0xff);
- ++out;
- }
+ BOOST_CHECK_EQUAL (memcmp (ref_buffer, check_buffer, this_time), 0);
+ N -= this_time;
}
- uint8_t remainder[-delay_length];
- d.get_remaining (remainder);
- returned += -delay_length;
-
- for (int i = 0; i < -delay_length; ++i) {
- BOOST_CHECK_EQUAL (remainder[i], 0);
- ++out;
- }
-
- BOOST_CHECK_EQUAL (returned, 256 * block_length);
-
-}
-
-BOOST_AUTO_TEST_CASE (delay_line_test)
-{
- do_positive_delay_line_test (64, 128);
- do_positive_delay_line_test (128, 64);
- do_positive_delay_line_test (3, 512);
- do_positive_delay_line_test (512, 3);
-
- do_positive_delay_line_test (0, 64);
+ delete[] ref_buffer;
+ delete[] check_buffer;
- do_negative_delay_line_test (-64, 128);
- do_negative_delay_line_test (-128, 64);
- do_negative_delay_line_test (-3, 512);
- do_negative_delay_line_test (-512, 3);
+ fclose (ref_file);
+ fclose (check_file);
}
-BOOST_AUTO_TEST_CASE (md5_digest_test)
+static void
+note (libdcp::NoteType t, string n)
{
- string const t = md5_digest ("test/md5.test");
- BOOST_CHECK_EQUAL (t, "15058685ba99decdc4398c7634796eb0");
-
- BOOST_CHECK_THROW (md5_digest ("foobar"), OpenFileError);
-}
-
-BOOST_AUTO_TEST_CASE (paths_test)
-{
- shared_ptr<Film> f = new_test_film ("paths_test");
- f->set_directory ("build/test/a/b/c/d/e");
- vector<int> thumbs;
- thumbs.push_back (42);
- f->set_thumbs (thumbs);
- BOOST_CHECK_EQUAL (f->thumb_file (0), "build/test/a/b/c/d/e/thumbs/00000042.png");
-
- f->_content = "/foo/bar/baz";
- BOOST_CHECK_EQUAL (f->content_path(), "/foo/bar/baz");
- f->_content = "foo/bar/baz";
- BOOST_CHECK_EQUAL (f->content_path(), "build/test/a/b/c/d/e/foo/bar/baz");
+ if (t == libdcp::ERROR) {
+ cerr << n << "\n";
+ }
}
void
-do_remote_encode (shared_ptr<DCPVideoFrame> frame, ServerDescription* description, shared_ptr<EncodedData> locally_encoded, int N)
-{
- shared_ptr<EncodedData> remotely_encoded;
- BOOST_CHECK_NO_THROW (remotely_encoded = frame->encode_remotely (description));
- BOOST_CHECK (remotely_encoded);
+check_dcp (boost::filesystem::path ref, boost::filesystem::path check)
+{
+ libdcp::DCP ref_dcp (ref);
+ ref_dcp.read ();
+ libdcp::DCP check_dcp (check);
+ check_dcp.read ();
+
+ libdcp::EqualityOptions options;
+ options.max_mean_pixel_error = 5;
+ options.max_std_dev_pixel_error = 5;
+ options.max_audio_sample_error = 255;
+ options.cpl_names_can_differ = true;
+ options.mxf_names_can_differ = true;
- BOOST_CHECK_EQUAL (locally_encoded->size(), remotely_encoded->size());
- BOOST_CHECK (memcmp (locally_encoded->data(), remotely_encoded->data(), locally_encoded->size()) == 0);
+ BOOST_CHECK (ref_dcp.equals (check_dcp, options, boost::bind (note, _1, _2)));
}
-BOOST_AUTO_TEST_CASE (client_server_test)
-{
- shared_ptr<Image> image (new CompactImage (PIX_FMT_RGB24, Size (1998, 1080)));
- uint8_t* p = image->data()[0];
-
- for (int y = 0; y < 1080; ++y) {
- for (int x = 0; x < 1998; ++x) {
- *p++ = x % 256;
- *p++ = y % 256;
- *p++ = (x + y) % 256;
+void
+check_xml (xmlpp::Element* ref, xmlpp::Element* test, list<string> ignore)
+{
+ BOOST_CHECK_EQUAL (ref->get_name (), test->get_name ());
+ BOOST_CHECK_EQUAL (ref->get_namespace_prefix (), test->get_namespace_prefix ());
+
+ if (find (ignore.begin(), ignore.end(), ref->get_name()) != ignore.end ()) {
+ return;
+ }
+
+ xmlpp::Element::NodeList ref_children = ref->get_children ();
+ xmlpp::Element::NodeList test_children = test->get_children ();
+ BOOST_CHECK_EQUAL (ref_children.size (), test_children.size ());
+
+ xmlpp::Element::NodeList::iterator k = ref_children.begin ();
+ xmlpp::Element::NodeList::iterator l = test_children.begin ();
+ while (k != ref_children.end ()) {
+
+ /* XXX: should be doing xmlpp::EntityReference, xmlpp::XIncludeEnd, xmlpp::XIncludeStart */
+
+ xmlpp::Element* ref_el = dynamic_cast<xmlpp::Element*> (*k);
+ xmlpp::Element* test_el = dynamic_cast<xmlpp::Element*> (*l);
+ BOOST_CHECK ((ref_el && test_el) || (!ref_el && !test_el));
+ if (ref_el && test_el) {
+ check_xml (ref_el, test_el, ignore);
}
- }
- shared_ptr<Image> sub_image (new CompactImage (PIX_FMT_RGBA, Size (100, 200)));
- p = sub_image->data()[0];
- for (int y = 0; y < 200; ++y) {
- for (int x = 0; x < 100; ++x) {
- *p++ = y % 256;
- *p++ = x % 256;
- *p++ = (x + y) % 256;
- *p++ = 1;
+ xmlpp::ContentNode* ref_cn = dynamic_cast<xmlpp::ContentNode*> (*k);
+ xmlpp::ContentNode* test_cn = dynamic_cast<xmlpp::ContentNode*> (*l);
+ BOOST_CHECK ((ref_cn && test_cn) || (!ref_cn && !test_cn));
+ if (ref_cn && test_cn) {
+ BOOST_CHECK_EQUAL (ref_cn->get_content(), test_cn->get_content ());
}
- }
- shared_ptr<Subtitle> subtitle (new Subtitle (Position (50, 60), sub_image));
-
- FileLog log ("build/test/client_server_test.log");
-
- shared_ptr<DCPVideoFrame> frame (
- new DCPVideoFrame (
- image,
- subtitle,
- Size (1998, 1080),
- 0,
- 0,
- 1,
- Scaler::from_id ("bicubic"),
- 0,
- 24,
- "",
- 0,
- 200000000,
- &log
- )
- );
-
- shared_ptr<EncodedData> locally_encoded = frame->encode_locally ();
- BOOST_ASSERT (locally_encoded);
-
- Server* server = new Server (&log);
-
- new thread (boost::bind (&Server::run, server, 2));
-
- /* Let the server get itself ready */
- dvdomatic_sleep (1);
-
- ServerDescription description ("localhost", 2);
-
- list<thread*> threads;
- for (int i = 0; i < 8; ++i) {
- threads.push_back (new thread (boost::bind (do_remote_encode, frame, &description, locally_encoded, i)));
- }
-
- for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
- (*i)->join ();
- }
-
- for (list<thread*>::iterator i = threads.begin(); i != threads.end(); ++i) {
- delete *i;
- }
-}
-
-BOOST_AUTO_TEST_CASE (make_dcp_test)
-{
- shared_ptr<Film> film = new_test_film ("make_dcp_test");
- film->set_name ("test_film2");
- film->set_content ("../../../test/test.mp4");
- film->set_format (Format::from_nickname ("Flat"));
- film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
- film->make_dcp (true);
-
- while (JobManager::instance()->work_to_do ()) {
- dvdomatic_sleep (1);
- }
-
- BOOST_CHECK_EQUAL (JobManager::instance()->errors(), false);
-}
+ xmlpp::Attribute* ref_at = dynamic_cast<xmlpp::Attribute*> (*k);
+ xmlpp::Attribute* test_at = dynamic_cast<xmlpp::Attribute*> (*l);
+ BOOST_CHECK ((ref_at && test_at) || (!ref_at && !test_at));
+ if (ref_at && test_at) {
+ BOOST_CHECK_EQUAL (ref_at->get_name(), test_at->get_name ());
+ BOOST_CHECK_EQUAL (ref_at->get_value(), test_at->get_value ());
+ }
-BOOST_AUTO_TEST_CASE (make_dcp_with_range_test)
-{
- shared_ptr<Film> film = new_test_film ("make_dcp_with_range_test");
- film->set_name ("test_film3");
- film->set_content ("../../../test/test.mp4");
- film->examine_content ();
- film->set_format (Format::from_nickname ("Flat"));
- film->set_dcp_content_type (DCPContentType::from_pretty_name ("Test"));
- film->set_dcp_trim_end (42);
- film->make_dcp (true);
-
- while (JobManager::instance()->work_to_do() && !JobManager::instance()->errors()) {
- dvdomatic_sleep (1);
+ ++k;
+ ++l;
}
-
- BOOST_CHECK_EQUAL (JobManager::instance()->errors(), false);
}
-BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)
+void
+check_xml (boost::filesystem::path ref, boost::filesystem::path test, list<string> ignore)
{
- shared_ptr<Film> f = new_test_film ("audio_sampling_rate_test");
- f->set_frames_per_second (24);
-
- f->set_audio_sample_rate (48000);
- BOOST_CHECK_EQUAL (f->target_audio_sample_rate(), 48000);
+ xmlpp::DomParser* ref_parser = new xmlpp::DomParser (ref.string ());
+ xmlpp::Element* ref_root = ref_parser->get_document()->get_root_node ();
+ xmlpp::DomParser* test_parser = new xmlpp::DomParser (test.string ());
+ xmlpp::Element* test_root = test_parser->get_document()->get_root_node ();
- f->set_audio_sample_rate (44100);
- BOOST_CHECK_EQUAL (f->target_audio_sample_rate(), 48000);
-
- f->set_audio_sample_rate (80000);
- BOOST_CHECK_EQUAL (f->target_audio_sample_rate(), 96000);
-
- f->set_frames_per_second (23.976);
- f->set_audio_sample_rate (48000);
- BOOST_CHECK_EQUAL (f->target_audio_sample_rate(), 47952);
-
- f->set_frames_per_second (29.97);
- f->set_audio_sample_rate (48000);
- BOOST_CHECK_EQUAL (f->target_audio_sample_rate(), 47952);
+ check_xml (ref_root, test_root, ignore);
}
-class TestJob : public Job
+void
+wait_for_jobs ()
{
-public:
- TestJob (shared_ptr<Film> f, shared_ptr<Job> req)
- : Job (f, req)
- {
-
- }
-
- void set_finished_ok () {
- set_state (FINISHED_OK);
+ JobManager* jm = JobManager::instance ();
+ while (jm->work_to_do ()) {
+ ui_signaller->ui_idle ();
}
-
- void set_finished_error () {
- set_state (FINISHED_ERROR);
- }
-
- void run ()
- {
- while (1) {
- if (finished ()) {
- return;
+ if (jm->errors ()) {
+ for (list<shared_ptr<Job> >::iterator i = jm->_jobs.begin(); i != jm->_jobs.end(); ++i) {
+ if ((*i)->finished_in_error ()) {
+ cerr << (*i)->error_summary () << "\n"
+ << (*i)->error_details () << "\n";
}
}
}
+
+ BOOST_CHECK (!jm->errors());
- string name () const {
- return "";
- }
-};
-
-BOOST_AUTO_TEST_CASE (job_manager_test)
-{
- shared_ptr<Film> f;
-
- /* Single job, no dependency */
- shared_ptr<TestJob> a (new TestJob (f, shared_ptr<Job> ()));
-
- JobManager::instance()->add (a);
- dvdomatic_sleep (1);
- BOOST_CHECK_EQUAL (a->running (), true);
- a->set_finished_ok ();
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->finished_ok(), true);
-
- /* Two jobs, dependency */
- a.reset (new TestJob (f, shared_ptr<Job> ()));
- shared_ptr<TestJob> b (new TestJob (f, a));
-
- JobManager::instance()->add (a);
- JobManager::instance()->add (b);
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->running(), true);
- BOOST_CHECK_EQUAL (b->running(), false);
- a->set_finished_ok ();
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->finished_ok(), true);
- BOOST_CHECK_EQUAL (b->running(), true);
- b->set_finished_ok ();
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (b->finished_ok(), true);
-
- /* Two jobs, dependency, first fails */
- a.reset (new TestJob (f, shared_ptr<Job> ()));
- b.reset (new TestJob (f, a));
-
- JobManager::instance()->add (a);
- JobManager::instance()->add (b);
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->running(), true);
- BOOST_CHECK_EQUAL (b->running(), false);
- a->set_finished_error ();
- dvdomatic_sleep (2);
- BOOST_CHECK_EQUAL (a->finished_in_error(), true);
- BOOST_CHECK_EQUAL (b->running(), false);
+ ui_signaller->ui_idle ();
}
-BOOST_AUTO_TEST_CASE (stream_test)
+void
+write_image (shared_ptr<const Image> image, boost::filesystem::path file)
{
- AudioStream a ("4 9 hello there world");
- BOOST_CHECK_EQUAL (a.id(), 4);
- BOOST_CHECK_EQUAL (a.channels(), 9);
- BOOST_CHECK_EQUAL (a.name(), "hello there world");
- BOOST_CHECK_EQUAL (a.to_string(), "4 9 hello there world");
-
- SubtitleStream s ("5 a b c");
- BOOST_CHECK_EQUAL (s.id(), 5);
- BOOST_CHECK_EQUAL (s.name(), "a b c");
+ using namespace MagickCore;
+
+ Magick::Image m (image->size().width, image->size().height, "ARGB", CharPixel, (void *) image->data()[0]);
+ m.write (file.string ());
}