doctest

FORK: The fastest feature-rich C++11/14/17/20 single-header testing framework
git clone https://git.neptards.moe/neptards/doctest.git
Log | Files | Refs | README

namespace9.cpp (985B)


      1 #include <doctest/doctest.h>
      2 
      3 DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_BEGIN
      4 #include <cstdint>
      5 #include <sstream>
      6 DOCTEST_MAKE_STD_HEADERS_CLEAN_FROM_WARNINGS_ON_WALL_END
      7 
      8 namespace user9a {
      9 struct label
     10 {
     11     label()
     12             : i(0) {}
     13     int i;
     14 };
     15 } // namespace user9a
     16 
     17 DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations")
     18 DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes")
     19 bool operator==(const user9a::label& lhs, const user9a::label& rhs) { return lhs.i == rhs.i; }
     20 
     21 namespace user9b {
     22 struct label
     23 {
     24     label()
     25             : i(0) {}
     26     int i;
     27 };
     28 } // namespace user9b
     29 
     30 DOCTEST_GCC_SUPPRESS_WARNING("-Wmissing-declarations")
     31 DOCTEST_CLANG_SUPPRESS_WARNING("-Wmissing-prototypes")
     32 
     33 bool operator==(const user9b::label& lhs, const user9b::label& rhs) { return lhs.i == rhs.i; }
     34 
     35 TEST_CASE("namespace 9 both global") {
     36     user9a::label a1;
     37     user9a::label a2;
     38 
     39     user9b::label b1;
     40     user9b::label b2;
     41 
     42     REQUIRE(a1 == a2);
     43     REQUIRE(b1 == b2);
     44 }