summaryrefslogtreecommitdiffstats
path: root/googletest/samples/prime_tables.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2022-03-15 20:41:41 (GMT)
committerCopybara-Service <copybara-worker@google.com>2022-03-15 20:42:11 (GMT)
commitb007c54f2944e193ac44fba1bc997cb65826a0b9 (patch)
tree3ea747410f93a40da0df6f8777e2ba551761cf8c /googletest/samples/prime_tables.h
parent8a422b8398dd7e2b6b3e1fcbfbceb43ead2a5761 (diff)
downloadgoogletest-b007c54f2944e193ac44fba1bc997cb65826a0b9.zip
googletest-b007c54f2944e193ac44fba1bc997cb65826a0b9.tar.gz
googletest-b007c54f2944e193ac44fba1bc997cb65826a0b9.tar.bz2
Running clang-format over all of GoogleTest
A few tests are examining code locations and looking af the resulting line numbers to verify that GoogleTest shows those to users correctly. Some of those locations change when clang-format is run. For those locations, I've wrapped portions in: // clang-format off ... // clang-format on There may be other locations that are currently not tickled by running clang-format. PiperOrigin-RevId: 434844712 Change-Id: I3a9f0a6f39eff741c576b6de389bef9b1d11139d
Diffstat (limited to 'googletest/samples/prime_tables.h')
-rw-r--r--googletest/samples/prime_tables.h8
1 files changed, 3 insertions, 5 deletions
diff --git a/googletest/samples/prime_tables.h b/googletest/samples/prime_tables.h
index 3a10352..7c0286e 100644
--- a/googletest/samples/prime_tables.h
+++ b/googletest/samples/prime_tables.h
@@ -27,8 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
// This provides interface PrimeTable that determines whether a number is a
// prime and determines a next prime number. This interface is used
// in Google Test samples demonstrating use of parameterized tests.
@@ -57,7 +55,7 @@ class OnTheFlyPrimeTable : public PrimeTable {
bool IsPrime(int n) const override {
if (n <= 1) return false;
- for (int i = 2; i*i <= n; i++) {
+ for (int i = 2; i * i <= n; i++) {
// n is divisible by an integer other than 1 and itself.
if ((n % i) == 0) return false;
}
@@ -104,13 +102,13 @@ class PreCalculatedPrimeTable : public PrimeTable {
// Checks every candidate for prime number (we know that 2 is the only even
// prime).
- for (int i = 2; i*i <= max; i += i%2+1) {
+ for (int i = 2; i * i <= max; i += i % 2 + 1) {
if (!is_prime_[i]) continue;
// Marks all multiples of i (except i itself) as non-prime.
// We are starting here from i-th multiplier, because all smaller
// complex numbers were already marked.
- for (int j = i*i; j <= max; j += i) {
+ for (int j = i * i; j <= max; j += i) {
is_prime_[j] = false;
}
}