YACA: support comments starting with # (regardless of = in the middle) 41/83241/4
authorLukasz Pawelczyk <l.pawelczyk@samsung.com>
Tue, 9 Aug 2016 15:38:49 +0000 (17:38 +0200)
committerLukasz Pawelczyk <l.pawelczyk@samsung.com>
Wed, 10 Aug 2016 15:49:29 +0000 (17:49 +0200)
Change-Id: I1ef080741cb1ab96b6579a09bb190897ec739bd8

src/yaca/yaca-test-vector.cpp

index 5b2011d..ae518e1 100644 (file)
@@ -195,8 +195,14 @@ TestVectorVector loadTestVector(const std::string &filename)
     RUNNER_ASSERT_MSG(ifs, "Failed to open " << filename);
     std::string line;
     TestVector tv;
-    while (std::getline(ifs, line))
-    {
+    while (std::getline(ifs, line)) {
+        /* truncate blank chars from the beginning of the line */
+        size_t i;
+        for (i = 0; i < line.size(); ++i)
+            if (!isblank(line[i]))
+                break;
+        line = line.substr(i);
+
         if (line.empty()) {
             /* next test vector */
             if (!tv.empty()) {
@@ -205,10 +211,10 @@ TestVectorVector loadTestVector(const std::string &filename)
             }
         } else {
             size_t equals = line.find('=');
+            bool comment = (line[0] == '#');
 
             /* ignore lines without '=' */
-            if (equals != std::string::npos)
-            {
+            if (!comment && equals != std::string::npos) {
                 std::string key = line.substr(0, equals);
                 std::string value = line.substr(equals + 1);
                 tv.add(key, value);