aboutsummaryrefslogtreecommitdiff
path: root/tests/test/simple/generated/driver.cxx
diff options
context:
space:
mode:
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;
}