sample4.cc (googletest-release-1.11.0) | : | sample4.cc (googletest-release-1.12.0) | ||
---|---|---|---|---|
skipping to change at line 32 | skipping to change at line 32 | |||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
// A sample program demonstrating using Google C++ testing framework. | // A sample program demonstrating using Google C++ testing framework. | |||
#include <stdio.h> | ||||
#include "sample4.h" | #include "sample4.h" | |||
#include <stdio.h> | ||||
// Returns the current counter value, and increments it. | // Returns the current counter value, and increments it. | |||
int Counter::Increment() { | int Counter::Increment() { return counter_++; } | |||
return counter_++; | ||||
} | ||||
// Returns the current counter value, and decrements it. | // Returns the current counter value, and decrements it. | |||
// counter can not be less than 0, return 0 in this case | // counter can not be less than 0, return 0 in this case | |||
int Counter::Decrement() { | int Counter::Decrement() { | |||
if (counter_ == 0) { | if (counter_ == 0) { | |||
return counter_; | return counter_; | |||
} else { | } else { | |||
return counter_--; | return counter_--; | |||
} | } | |||
} | } | |||
// Prints the current counter value to STDOUT. | // Prints the current counter value to STDOUT. | |||
void Counter::Print() const { | void Counter::Print() const { printf("%d", counter_); } | |||
printf("%d", counter_); | ||||
} | ||||
End of changes. 5 change blocks. | ||||
6 lines changed or deleted | 4 lines changed or added |