Debian Codegraph @

testing/projects/cpp_long_names/include/absurdly_long_names.hpp

raw
1 /***************************************************************************************
2 * This file is dedicated to the public domain. If your jurisdiction requires a *
3 * specific license: *
4 * *
5 * Copyright (c) Stephen McDowell, 2017-2024 *
6 * License: CC0 1.0 Universal *
7 * License Text: https://creativecommons.org/publicdomain/zero/1.0/legalcode *
8 **************************************************************************************/
9 /**
10 * \file
11 *
12 * \brief Tests constructs with names longer than 255 characters.
13 *
14 * Tests the following kinds:
15 *
16 * - ``class``
17 * - ``struct``
18 * - ``function``
19 * - ``enum``
20 * - ``namespace``
21 * - ``define``
22 * - ``typedef``
23 * - ``variable``
24 * - ``union``
25 *
26 * Ignored kinds not explicitly tested (at least in this file):
27 *
28 * - ``enumvalue`` (unused in exhale)
29 * - ``file`` (pointless to test directly)
30 * - ``dir`` (pointless to test directly)
31 * - ``group`` (unused in exhale)
32 */
33 #pragma once
34
35 #include <string>
36
37 /// A macro for making the absurdly long names.
38 #define MAKE_IT_BIG(prefix) prefix##_that_is_longer_than_two_hundred_and_fifty_five_characters_long_which_is_an_absolutely_and_completely_ridiculous_thing_to_do_and_if_you_did_this_in_the_real_world_you_put_yourself_comfortably_in_a_position_to_be_downsized_and_outta_here_as_soul_position_would_explain_to_you
39
40 /// A class with an absurdly long name.
41 class MAKE_IT_BIG(class) {
42 public:
43 static constexpr int value = 1;///< An absurd value ``1`` that means nothing.
44 };
45
46 /// A struct with an absurdly long name.
47 struct MAKE_IT_BIG(struct) {
48 static constexpr int value = 2;///< An absurd value ``2`` that means nothing.
49 };
50
51 /// A function with an absurdly long name. Returns a string describing the divergence number of the current world line.
52 inline std::string MAKE_IT_BIG(function)() {
53 return "The divergence number: 0.999999999";// poor Mayuri...
54 }
55
56 /// An enum with an absurdly long name.
57 enum MAKE_IT_BIG(enum) {
58 first = 1,///< The first value of the absurd enum.
59 second, ///< The second value of the absurd enum.
60 third ///< The third value of the absurd enum.
61 };
62
63 /// An absurdly long namespace.
64 namespace MAKE_IT_BIG(namespace) {
65 static constexpr int value = 0;///< An absurd value ``0`` that means nothing.
66 }
67
68 /// A preprocessor ``define`` that has an absurdly long name.
69 #define DEFINE_THAT_IS_LONGER_THAN_TWO_HUNDRED_AND_FIFTY_FIVE_CHARACTERS_LONG_WHICH_IS_AN_ABSOLUTELY_AND_COMPLETELY_RIDICULOUS_THING_TO_DO_AND_IF_YOU_DID_THIS_IN_THE_REAL_WORLD_YOU_PUT_YOURSELF_COMFORTABLY_IN_A_POSITION_TO_BE_DOWNSIZED_AND_OUTTA_HERE_AS_SOUL_POSITION_WOULD_EXPLAIN_TO_YOU "Jajajaja"
70
71 /// A variable with an absurdly long value.
72 static constexpr int MAKE_IT_BIG(variable) = 929;
73
74 /// A typedef to an absurdly long name.
75 using MAKE_IT_BIG(typedef) = float;
76
77 // copy-pasted-ish: https://en.cppreference.com/w/cpp/language/union
78 /// A union with an absurdly long name which occupies 4 bytes total.
79 union MAKE_IT_BIG(union) {
80 std::int32_t n; ///< occupies 4 bytes
81 std::uint16_t s[2];///< occupies 4 bytes
82 std::uint8_t c; ///< occupies 1 byte
83 };