Line data Source code
1 : // Copyright (c) 2011-2025 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/snapdev
4 : // contact@m2osw.com
5 : //
6 : // This program is free software: you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation, either version 3 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License
17 : // along with this program. If not, see <https://www.gnu.org/licenses/>.
18 :
19 : /** \file
20 : * \brief Verify the NOT_USED() functions.
21 : *
22 : * This file implements tests to verify that the unique_number implementation
23 : * works properly even when multiple processes use it simultaneously.
24 : */
25 :
26 : // file being tested
27 : //
28 : #include <snapdev/not_used.h>
29 :
30 :
31 : // self
32 : //
33 : #include "catch_main.h"
34 :
35 :
36 : // last include
37 : //
38 : #include <snapdev/poison.h>
39 :
40 :
41 :
42 : namespace
43 : {
44 :
45 :
46 :
47 1 : int verify_void(int a)
48 : {
49 1 : snapdev::NOT_USED();
50 1 : return a;
51 : }
52 :
53 :
54 1 : int verify(int a, long b, float c)
55 : {
56 1 : snapdev::NOT_USED(b, c);
57 1 : return a;
58 : }
59 :
60 :
61 :
62 : } // no name namespace
63 :
64 :
65 :
66 2 : CATCH_TEST_CASE("not_used", "[not_used]")
67 : {
68 2 : CATCH_START_SECTION("not_used: verify NOT_USED() without parameters")
69 : {
70 1 : CATCH_REQUIRE(verify_void(1409) == 1409);
71 : }
72 2 : CATCH_END_SECTION()
73 :
74 2 : CATCH_START_SECTION("not_used: verify NOT_USED() works as expected (2 parameters)")
75 : {
76 1 : CATCH_REQUIRE(verify(34, -1000, 3.1409) == 34);
77 : }
78 2 : CATCH_END_SECTION()
79 2 : }
80 :
81 :
82 :
83 : // vim: ts=4 sw=4 et
|