From 01e28d8013ae6fbaef3d80cf5d617f457342a2e6 Mon Sep 17 00:00:00 2001
From: ilor <kailoran@gmail.com>
Date: Thu, 9 Dec 2010 16:52:39 +0100
Subject: [PATCH] fix line no handling in data driven tests

---
 tests/datadriven.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/datadriven.cpp b/tests/datadriven.cpp
index c390549..8de4828 100644
--- a/tests/datadriven.cpp
+++ b/tests/datadriven.cpp
@@ -47,7 +47,9 @@ void test_one_item_actual(const compare_test& c)
 	std::string tagset_name = "kipi";
 	std::string sentence_filename;
 	std::string line;
+	int line_no = 0;
 	while (ifs_in.good() && line != "---") {
+		++line_no;
 		std::getline(ifs_in, line);
 		std::vector<std::string> fields;
 		boost::algorithm::split(fields, line, boost::is_any_of(separators));
@@ -71,7 +73,6 @@ void test_one_item_actual(const compare_test& c)
 
 	std::string operator_string, expected_output;
 
-	int line_no = 0;
 	while (ifs_in.good()) {
 		++line_no;
 		std::getline(ifs_in, line);
@@ -97,8 +98,8 @@ void test_one_item_actual(const compare_test& c)
 			}
 			expected_output = "";
 			operator_string = "";
-			++line_no;
 			while (ifs_in.good() && line != "---" && line != "") {
+				++line_no;
 				std::getline(ifs_in, line);
 				std::vector<std::string> fields;
 				boost::algorithm::split(fields, line, boost::is_any_of(separators));
-- 
GitLab