summaryrefslogtreecommitdiffstats
path: root/tests/test/simple/generated/driver.cxx
blob: a7c0875353253c273609d7e58aa16b95b9ab1a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// file      : tests/test/simple/generated/driver.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#include <string>
#include <fstream>
#include <iostream>

using namespace std;

int
main (int argc, char* argv[])
{
  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;
}