From 76df4c19901c7ae9ec99c5d2154bb4398ee632f4 Mon Sep 17 00:00:00 2001
From: ilor <kailoran@gmail.com>
Date: Wed, 27 Apr 2011 14:25:59 +0200
Subject: [PATCH] fix data rule test ccl file loading

---
 tests/datarule.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/datarule.cpp b/tests/datarule.cpp
index 871f2a5..de6c6d3 100644
--- a/tests/datarule.cpp
+++ b/tests/datarule.cpp
@@ -150,9 +150,15 @@ void test_one_rule_item_actual(const rule_compare_test& c)
 	if (!chunk) {
 		BOOST_ERROR("Empty chunk loaded");
 	}
-	Corpus2::XcesReader xr(tagset, c.output_corpus.string());
-	xr.set_option("loose");
-	boost::shared_ptr<Corpus2::Chunk> expected = xr.get_next_chunk();
+	boost::shared_ptr<Corpus2::TokenReader> reader;
+	std::string ofn = c.output_corpus.filename();
+	if (ofn.find("ccl") != ofn.npos) {
+		reader = Corpus2::TokenReader::create_path_reader("ccl", tagset, c.output_corpus.string());
+	} else {
+		reader = Corpus2::TokenReader::create_path_reader("xces", tagset, c.output_corpus.string());
+	}
+	reader->set_option("loose");
+	boost::shared_ptr<Corpus2::Chunk> expected = reader->get_next_chunk();
 	BOOST_REQUIRE_EQUAL(chunk->sentences().size(), expected->sentences().size());
 	Wccl::Parser parser(tagset);
 	std::string rf = c.rule_file.string();
-- 
GitLab