14b6829f0d28990dd645e16386eb226d0f10c8731shiqian// Copyright 2005, Google Inc.
24b6829f0d28990dd645e16386eb226d0f10c8731shiqian// All rights reserved.
34b6829f0d28990dd645e16386eb226d0f10c8731shiqian//
44b6829f0d28990dd645e16386eb226d0f10c8731shiqian// Redistribution and use in source and binary forms, with or without
54b6829f0d28990dd645e16386eb226d0f10c8731shiqian// modification, are permitted provided that the following conditions are
64b6829f0d28990dd645e16386eb226d0f10c8731shiqian// met:
74b6829f0d28990dd645e16386eb226d0f10c8731shiqian//
84b6829f0d28990dd645e16386eb226d0f10c8731shiqian//     * Redistributions of source code must retain the above copyright
94b6829f0d28990dd645e16386eb226d0f10c8731shiqian// notice, this list of conditions and the following disclaimer.
104b6829f0d28990dd645e16386eb226d0f10c8731shiqian//     * Redistributions in binary form must reproduce the above
114b6829f0d28990dd645e16386eb226d0f10c8731shiqian// copyright notice, this list of conditions and the following disclaimer
124b6829f0d28990dd645e16386eb226d0f10c8731shiqian// in the documentation and/or other materials provided with the
134b6829f0d28990dd645e16386eb226d0f10c8731shiqian// distribution.
144b6829f0d28990dd645e16386eb226d0f10c8731shiqian//     * Neither the name of Google Inc. nor the names of its
154b6829f0d28990dd645e16386eb226d0f10c8731shiqian// contributors may be used to endorse or promote products derived from
164b6829f0d28990dd645e16386eb226d0f10c8731shiqian// this software without specific prior written permission.
174b6829f0d28990dd645e16386eb226d0f10c8731shiqian//
184b6829f0d28990dd645e16386eb226d0f10c8731shiqian// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
194b6829f0d28990dd645e16386eb226d0f10c8731shiqian// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
204b6829f0d28990dd645e16386eb226d0f10c8731shiqian// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
214b6829f0d28990dd645e16386eb226d0f10c8731shiqian// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
224b6829f0d28990dd645e16386eb226d0f10c8731shiqian// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
234b6829f0d28990dd645e16386eb226d0f10c8731shiqian// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
244b6829f0d28990dd645e16386eb226d0f10c8731shiqian// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
254b6829f0d28990dd645e16386eb226d0f10c8731shiqian// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
264b6829f0d28990dd645e16386eb226d0f10c8731shiqian// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
274b6829f0d28990dd645e16386eb226d0f10c8731shiqian// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
284b6829f0d28990dd645e16386eb226d0f10c8731shiqian// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
294b6829f0d28990dd645e16386eb226d0f10c8731shiqian
304b6829f0d28990dd645e16386eb226d0f10c8731shiqian// A sample program demonstrating using Google C++ testing framework.
314b6829f0d28990dd645e16386eb226d0f10c8731shiqian//
324b6829f0d28990dd645e16386eb226d0f10c8731shiqian// Author: wan@google.com (Zhanyong Wan)
334b6829f0d28990dd645e16386eb226d0f10c8731shiqian
344b6829f0d28990dd645e16386eb226d0f10c8731shiqian#ifndef GTEST_SAMPLES_SAMPLE4_H_
354b6829f0d28990dd645e16386eb226d0f10c8731shiqian#define GTEST_SAMPLES_SAMPLE4_H_
364b6829f0d28990dd645e16386eb226d0f10c8731shiqian
374b6829f0d28990dd645e16386eb226d0f10c8731shiqian// A simple monotonic counter.
384b6829f0d28990dd645e16386eb226d0f10c8731shiqianclass Counter {
394b6829f0d28990dd645e16386eb226d0f10c8731shiqian private:
404b6829f0d28990dd645e16386eb226d0f10c8731shiqian  int counter_;
414b6829f0d28990dd645e16386eb226d0f10c8731shiqian
424b6829f0d28990dd645e16386eb226d0f10c8731shiqian public:
434b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // Creates a counter that starts at 0.
444b6829f0d28990dd645e16386eb226d0f10c8731shiqian  Counter() : counter_(0) {}
454b6829f0d28990dd645e16386eb226d0f10c8731shiqian
464b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // Returns the current counter value, and increments it.
474b6829f0d28990dd645e16386eb226d0f10c8731shiqian  int Increment();
484b6829f0d28990dd645e16386eb226d0f10c8731shiqian
494b6829f0d28990dd645e16386eb226d0f10c8731shiqian  // Prints the current counter value to STDOUT.
504b6829f0d28990dd645e16386eb226d0f10c8731shiqian  void Print() const;
514b6829f0d28990dd645e16386eb226d0f10c8731shiqian};
524b6829f0d28990dd645e16386eb226d0f10c8731shiqian
534b6829f0d28990dd645e16386eb226d0f10c8731shiqian#endif  // GTEST_SAMPLES_SAMPLE4_H_
54