Line data Source code
1 : /* test_addr_main.cpp
2 : * Copyright (c) 2011-2019 Made to Order Software Corp. All Rights Reserved
3 : *
4 : * Project: https://snapwebsites.org/project/libaddr
5 : *
6 : * Permission is hereby granted, free of charge, to any
7 : * person obtaining a copy of this software and
8 : * associated documentation files (the "Software"), to
9 : * deal in the Software without restriction, including
10 : * without limitation the rights to use, copy, modify,
11 : * merge, publish, distribute, sublicense, and/or sell
12 : * copies of the Software, and to permit persons to whom
13 : * the Software is furnished to do so, subject to the
14 : * following conditions:
15 : *
16 : * The above copyright notice and this permission notice
17 : * shall be included in all copies or substantial
18 : * portions of the Software.
19 : *
20 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
21 : * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
22 : * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
23 : * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
24 : * EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 : * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 : * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27 : * ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 : * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 : * SOFTWARE.
30 : */
31 :
32 : /** \file
33 : * \brief The main() function of the addr library tests.
34 : *
35 : * This file implements the main() function of the unit tests used to
36 : * verify the addr library.
37 : *
38 : * It defines any globals (none at this point) and a few basic command
39 : * line options such as --help and --version.
40 : */
41 :
42 : // Tell catch we want it to add the runner code in this file.
43 : #define CATCH_CONFIG_RUNNER
44 :
45 : // self
46 : //
47 : #include "test_addr_main.h"
48 :
49 :
50 :
51 :
52 : namespace SNAP_CATCH2_NAMESPACE
53 : {
54 :
55 : int g_tcp_port = -1;
56 :
57 : }
58 :
59 :
60 : namespace
61 : {
62 :
63 :
64 2 : Catch::clara::Parser add_command_line_options(Catch::clara::Parser const & cli)
65 : {
66 : return cli
67 : | Catch::clara::Opt(SNAP_CATCH2_NAMESPACE::g_tcp_port, "port")
68 4 : ["--tcp-port"]
69 6 : ("define a TCP port we can connect to to test the get_from_socket() function");
70 : }
71 :
72 :
73 : }
74 : // namespace
75 :
76 :
77 2 : int main(int argc, char * argv[])
78 : {
79 : return SNAP_CATCH2_NAMESPACE::snap_catch2_main(
80 : "libaddr"
81 : , LIBADDR_VERSION_STRING
82 : , argc
83 : , argv
84 : , nullptr
85 : , &add_command_line_options
86 : , nullptr
87 : , nullptr
88 2 : );
89 6 : }
90 :
91 : // vim: ts=4 sw=4 et
|