Line data Source code
1 : // Copyright (c) 2023-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 that SNAPDEV_STRINGIZE() works as expected.
21 : *
22 : * This file implements tests to verify the stringize macro.
23 : */
24 :
25 : // self
26 : //
27 : #include <snapdev/stringize.h>
28 :
29 : #include "catch_main.h"
30 :
31 :
32 : // last include
33 : //
34 : #include <snapdev/poison.h>
35 :
36 :
37 :
38 1 : CATCH_TEST_CASE("stringize", "[string]")
39 : {
40 1 : CATCH_START_SECTION("stringize: build year")
41 : {
42 1 : std::string copyright("Copyright (c) 2023-"
43 : SNAPDEV_STRINGIZE(UTC_BUILD_YEAR)
44 3 : " by Made to Order Software Corporation, All Rights Reserved");
45 :
46 1 : std::stringstream ss;
47 1 : ss << "Copyright (c) 2023-";
48 1 : ss << UTC_BUILD_YEAR;
49 1 : ss << " by Made to Order Software Corporation, All Rights Reserved";
50 :
51 1 : CATCH_REQUIRE(ss.str() == copyright);
52 1 : }
53 1 : CATCH_END_SECTION()
54 1 : }
55 :
56 :
57 :
58 : // vim: ts=4 sw=4 et
|