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