summaryrefslogtreecommitdiffstats
path: root/security/nss/gtests/google_test/gtest/samples/sample4.cc
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-18 11:39:00 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-18 11:39:00 +0100
commit76fe52eb81db323ceaa8396de39b76efbce1c25e (patch)
tree061c409281374d893f9730f89e6a4ef32d0b53f9 /security/nss/gtests/google_test/gtest/samples/sample4.cc
parent63635e38ff9341c02fae7f4557d230ec710947b6 (diff)
parent680c3eadb6aaec1f3653636db081a519e0f62ef5 (diff)
downloadUXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.tar
UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.tar.gz
UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.tar.lz
UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.tar.xz
UXP-76fe52eb81db323ceaa8396de39b76efbce1c25e.zip
Merge branch 'master' into Basilisk-releasev2018.12.18
Diffstat (limited to 'security/nss/gtests/google_test/gtest/samples/sample4.cc')
-rw-r--r--security/nss/gtests/google_test/gtest/samples/sample4.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/security/nss/gtests/google_test/gtest/samples/sample4.cc b/security/nss/gtests/google_test/gtest/samples/sample4.cc
index ae44bda6f..b0ee6093b 100644
--- a/security/nss/gtests/google_test/gtest/samples/sample4.cc
+++ b/security/nss/gtests/google_test/gtest/samples/sample4.cc
@@ -28,8 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// A sample program demonstrating using Google C++ testing framework.
-//
-// Author: wan@google.com (Zhanyong Wan)
#include <stdio.h>
@@ -40,6 +38,16 @@ int Counter::Increment() {
return counter_++;
}
+// Returns the current counter value, and decrements it.
+// counter can not be less than 0, return 0 in this case
+int Counter::Decrement() {
+ if (counter_ == 0) {
+ return counter_;
+ } else {
+ return counter_--;
+ }
+}
+
// Prints the current counter value to STDOUT.
void Counter::Print() const {
printf("%d", counter_);