]>
git.ipfire.org Git - thirdparty/squid.git/blob - test-suite/syntheticoperators.cc
39ba305f0fa444b19e75a654eee2522440f80333
3 * $Id: syntheticoperators.cc,v 1.1 2003/07/10 01:31:51 robertc Exp $
5 * AUTHOR: Robert Collins
7 * SQUID Web Proxy Cache http://www.squid-cache.org/
8 * ----------------------------------------------------------
10 * Squid is the result of efforts by numerous individuals from
11 * the Internet community; see the CONTRIBUTORS file for full
12 * details. Many organizations have provided support for Squid's
13 * development; see the SPONSORS file for full details. Squid is
14 * Copyrighted (C) 2001 by the Regents of the University of
15 * California; see the COPYRIGHT file for full details. Squid
16 * incorporates software developed and/or copyrighted by other
17 * sources; see the CREDITS file for full details.
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
33 * Copyright (c) 2003 Robert Collins <robertc@squid-cache.org>
46 HasExplicit(HasExplicit
const &);
47 HasExplicit
&operator=(HasExplicit
const &);
48 static int const &Instances();
49 static int const &Assignments();
50 static void Assignments(int const &);
52 static void AddInstance();
53 static void RemoveInstance();
54 static void Assignment();
55 static int Instances_
;
56 static int Assignments_
;
59 int HasExplicit::Instances_(0);
60 int HasExplicit::Assignments_(0);
62 HasExplicit::HasExplicit()
67 HasExplicit::~HasExplicit()
72 HasExplicit::HasExplicit(HasExplicit
const &)
78 HasExplicit::operator= (HasExplicit
const &)
85 HasExplicit::AddInstance()
91 HasExplicit::RemoveInstance()
97 HasExplicit::Assignment()
103 HasExplicit::Instances()
109 HasExplicit::Assignments()
115 HasExplicit::Assignments(int const &newValue
)
117 Assignments_
= newValue
;
121 CheckHasExplicitWorks()
123 assert (HasExplicit::Instances() == 0);
124 HasExplicit
*one
= new HasExplicit
;
125 assert (HasExplicit::Instances() == 1);
126 HasExplicit
*two
= new HasExplicit
;
127 assert (HasExplicit::Instances() == 2);
129 assert (HasExplicit::Instances() == 2);
130 assert (HasExplicit::Assignments() == 1);
132 assert (HasExplicit::Instances() == 2);
133 assert (HasExplicit::Assignments() == 2);
134 HasExplicit
*three
= new HasExplicit(*two
);
135 assert (HasExplicit::Instances() == 3);
137 assert (HasExplicit::Instances() == 2);
139 assert (HasExplicit::Instances() == 1);
141 assert (HasExplicit::Instances() == 0);
142 HasExplicit::Assignments(0);
143 assert (HasExplicit::Assignments() == 0);
146 class SyntheticOwnsExplicit
153 CheckSyntheticWorks()
155 assert (HasExplicit::Instances() == 0);
156 assert (HasExplicit::Assignments() == 0);
157 SyntheticOwnsExplicit
*one
= new SyntheticOwnsExplicit
;
158 assert (HasExplicit::Instances() == 1);
159 SyntheticOwnsExplicit
*two
= new SyntheticOwnsExplicit
;
160 assert (HasExplicit::Instances() == 2);
162 assert (HasExplicit::Instances() == 2);
163 assert (HasExplicit::Assignments() == 1);
165 assert (HasExplicit::Instances() == 2);
166 assert (HasExplicit::Assignments() == 2);
167 SyntheticOwnsExplicit
*three
= new SyntheticOwnsExplicit(*two
);
168 assert (HasExplicit::Instances() == 3);
170 assert (HasExplicit::Instances() == 2);
172 assert (HasExplicit::Instances() == 1);
174 assert (HasExplicit::Instances() == 0);
175 HasExplicit::Assignments(0);
176 assert (HasExplicit::Assignments() == 0);
180 main(int argc
, char **argv
)
182 CheckHasExplicitWorks();
183 CheckSyntheticWorks();