diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-09 15:00:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-02-09 15:00:16 +0200 |
commit | ab0d6919707349436edd336bbfa8f433bd6e6749 (patch) | |
tree | 864fc885d71ab8205f9c47f0c813b0a48166de33 /tests/test/simple/generated/driver.cxx | |
parent | dab05fa5ebea3aaf7107c8acf18a7f17c556a45c (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.cxx | 25 |
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; } |