vector<string> b;
boost::algorithm::split (b, a[2], boost::is_any_of (","));
+ if (b.size() != 2) {
+ throw SubripError (t, "time in the format h:m:s,ms", _context);
+ }
return Time::from_hms (
lexical_cast<int> (a[0]),
#include "subrip_reader.h"
#include "subtitle.h"
#include "test.h"
+#include "exceptions.h"
#include "collect.h"
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
fclose (f);
}
+static void
+test_throw (boost::filesystem::path p)
+{
+ p = private_test / p;
+ FILE* f = fopen (p.string().c_str(), "r");
+ BOOST_CHECK (f);
+ if (!f) {
+ cerr << p << " not found.\n";
+ return;
+ }
+ BOOST_CHECK_THROW (sub::SubripReader r(f), sub::SubripError);
+ fclose (f);
+}
+
/** Test of reading some typical .srt files */
BOOST_AUTO_TEST_CASE (subrip_read_test)
{
test ("Fight.Club.1999.720p.BRRip.x264-x0r.srt");
test ("EU13.srt");
test ("Subtitulos_HURTO_eng.srt");
+ test_throw ("subtitulo1.srt");
}
#define SUB_START(f, t) \