aboutsummaryrefslogtreecommitdiff
path: root/tests/test/simple/generated/driver.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-02-09 15:00:16 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-09 15:00:16 +0200
commitab0d6919707349436edd336bbfa8f433bd6e6749 (patch)
tree864fc885d71ab8205f9c47f0c813b0a48166de33 /tests/test/simple/generated/driver.cxx
parentdab05fa5ebea3aaf7107c8acf18a7f17c556a45c (diff)
Fix broken test (and few other things)
Diffstat (limited to 'tests/test/simple/generated/driver.cxx')
-rw-r--r--tests/test/simple/generated/driver.cxx25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/test/simple/generated/driver.cxx b/tests/test/simple/generated/driver.cxx
index fb3ab8f..a8e5cab 100644
--- a/tests/test/simple/generated/driver.cxx
+++ b/tests/test/simple/generated/driver.cxx
@@ -2,10 +2,31 @@
// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
// license : MIT; see accompanying LICENSE file
+#include <string>
+#include <fstream>
#include <iostream>
+using namespace std;
+
int
-main ()
+main (int argc, char* argv[])
{
- std::cout << "1.2.3" << std::endl;
+ int r (0);
+
+ if (argc == 1)
+ {
+ cout << "1.2.3" << endl;
+ }
+ else
+ {
+ ifstream ifs (argv[1]);
+
+ if (!ifs.is_open ())
+ cerr << "unable to open " << argv[1] << endl;
+
+ string s;
+ r = getline (ifs, s) && s == "1.2.3" ? 0 : 1;
+ }
+
+ return r;
}