]> git.ipfire.org Git - thirdparty/squid.git/blob - test-suite/debug.cc
SourceFormat Enforcement
[thirdparty/squid.git] / test-suite / debug.cc
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /* DEBUG: section 19 Store Memory Primitives */
10
11 #include "squid.h"
12 #include "Debug.h"
13 #include "mem_node.h"
14 #include "stmem.h"
15
16 class StreamTest
17 {
18 public:
19 std::ostream &serialise(std::ostream &);
20 int getAnInt() const;
21 char const *getACString() const;
22 };
23
24 std::ostream &operator << (std::ostream &aStream, StreamTest &anObject)
25 {
26 return anObject.serialise(aStream);
27 }
28
29 std::ostream&
30 StreamTest::serialise(std::ostream &aStream)
31 {
32 aStream << "stream test";
33 return aStream;
34 }
35
36 int
37 StreamTest::getAnInt() const
38 {
39 return 5;
40 }
41
42 char const *
43 StreamTest::getACString() const
44 {
45 return "ThisIsAStreamTest";
46 }
47
48 int
49 main(int argc, char **argv)
50 {
51 Debug::Levels[1] = 8;
52 debugs (1,1,"test" << "string");
53 debugs (1,9,"dont show this" << "string");
54 debugs (1,1,"test" << "string");
55 debugs (1,1,"test" << "string");
56 if (true)
57 debugs(1,9,"this won't compile if the macro is broken.");
58 else
59 debugs(1, DBG_IMPORTANT,"bar");
60 StreamTest aStreamObject;
61 StreamTest *streamPointer (&aStreamObject);
62 debugs(1, DBG_IMPORTANT,aStreamObject);
63 debugs(1, DBG_IMPORTANT,streamPointer->getAnInt() << " " << aStreamObject.getACString());
64 return 0;
65 }
66