diff options
Diffstat (limited to 'googletest/samples')
-rw-r--r-- | googletest/samples/prime_tables.h | 5 | ||||
-rw-r--r-- | googletest/samples/sample10_unittest.cc | 1 | ||||
-rw-r--r-- | googletest/samples/sample9_unittest.cc | 1 |
3 files changed, 3 insertions, 4 deletions
diff --git a/googletest/samples/prime_tables.h b/googletest/samples/prime_tables.h index 7c0286e..08ad949 100644 --- a/googletest/samples/prime_tables.h +++ b/googletest/samples/prime_tables.h @@ -78,8 +78,9 @@ class PreCalculatedPrimeTable : public PrimeTable { public: // 'max' specifies the maximum number the prime table holds. explicit PreCalculatedPrimeTable(int max) - : is_prime_size_(max + 1), is_prime_(new bool[max + 1]) { - CalculatePrimesUpTo(max); + : is_prime_size_(std::max(1, max + 1)), + is_prime_(new bool[static_cast<size_t>(is_prime_size_)]) { + CalculatePrimesUpTo(is_prime_size_ - 1); } ~PreCalculatedPrimeTable() override { delete[] is_prime_; } diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc index 95b4811..2107954 100644 --- a/googletest/samples/sample10_unittest.cc +++ b/googletest/samples/sample10_unittest.cc @@ -38,7 +38,6 @@ using ::testing::InitGoogleTest; using ::testing::Test; using ::testing::TestEventListeners; using ::testing::TestInfo; -using ::testing::TestPartResult; using ::testing::UnitTest; namespace { diff --git a/googletest/samples/sample9_unittest.cc b/googletest/samples/sample9_unittest.cc index d627ea7..0a2f097 100644 --- a/googletest/samples/sample9_unittest.cc +++ b/googletest/samples/sample9_unittest.cc @@ -40,7 +40,6 @@ using ::testing::Test; using ::testing::TestEventListeners; using ::testing::TestInfo; using ::testing::TestPartResult; -using ::testing::TestSuite; using ::testing::UnitTest; namespace { // Provides alternative output mode which produces minimal amount of |