File: TestLongMacros.cpp

package info (click to toggle)
unittest%2B%2B 2.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 684 kB
  • sloc: cpp: 6,468; makefile: 24
file content (45 lines) | stat: -rw-r--r-- 1,011 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#define UNITTEST_DISABLE_SHORT_MACROS

#include "UnitTest++/UnitTestPP.h"

// This file is not intended to test every little thing, just a few basics to hopefully ensure
// the macros are working and the short macros are not defined.
UNITTEST_SUITE(LongMacros)
{
   UNITTEST_TEST(LongCheckMacroWorks)
   {
      UNITTEST_CHECK(true);
   }

   class Fixture
   {
   public:
      Fixture() : sanity_(true) {}
   protected:
      bool sanity_;
   };

   UNITTEST_TEST_FIXTURE(Fixture, LongFixtureMacroWorks)
   {
      UNITTEST_REQUIRE UNITTEST_CHECK(sanity_);
   }

   UNITTEST_TEST(ShortMacrosAreNotDefined)
   {
#if defined(CHECK) || \
    defined(CHECK_EQUAL) || \
    defined(CHECK_CLOSE) || \
    defined(CHECK_ARRAY_EQUAL) || \
    defined(CHECK_ARRAY_CLOSE) || \
    defined(CHECK_ARRAY2D_CLOSE) || \
    defined(CHECK_THROW) || \
    defined(CHECK_ASSERT) || \
    defined(SUITE) || \
    defined(TEST) || \
    defined(TEST_FIXTURE) || \
    defined(REQUIRE)

      UNITTEST_CHECK(false);
#endif
   }
}