summaryrefslogtreecommitdiff
path: root/tests/ctor/driver.cxx
blob: fce1038f7f712919d1117184615e6e21c21e4119 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// file      : tests/ctor/driver.cxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#include "test.hxx"

int
main (int argc, char* argv[])
{
  // Test that we can call all the c-tors unambiguously.
  //
  {
    options o1 (argc, argv);
    options o2 (argc, argv, true);
    options o3 (argc, argv, true,
                cli::unknown_mode::fail);
    options o4 (argc, argv, true,
                cli::unknown_mode::fail,
                cli::unknown_mode::stop);
  }

  {
    options o1 (1, argc, argv);
    options o2 (1, argc, argv, true);
    options o3 (1, argc, argv, true,
                cli::unknown_mode::fail);
    options o4 (1, argc, argv, true,
                cli::unknown_mode::fail,
                cli::unknown_mode::stop);
  }

  {
    int end;
    options o1 (argc, argv, end);
    options o2 (argc, argv, end, true);
    options o3 (argc, argv, end, true,
                cli::unknown_mode::fail);
    options o4 (argc, argv, end, true,
                cli::unknown_mode::fail,
                cli::unknown_mode::stop);
  }

  {
    int end;
    options o1 (1, argc, argv, end);
    options o2 (1, argc, argv, end, true);
    options o3 (1, argc, argv, end, true,
                cli::unknown_mode::fail);
    options o4 (1, argc, argv, end, true,
                cli::unknown_mode::fail,
                cli::unknown_mode::stop);
  }

  {
    cli::argv_scanner s (argc, argv);
    options o1 (s);
    options o2 (s, cli::unknown_mode::fail);
    options o3 (s, cli::unknown_mode::fail, cli::unknown_mode::stop);
  }
}