@@ -309,12 +309,13 @@ std::vector<TestParams> GetMessageTestParams(
309
309
return results;
310
310
}
311
311
312
- bool Mutate (const protobuf::Message& from, const protobuf::Message& to) {
312
+ bool Mutate (const protobuf::Message& from, const protobuf::Message& to,
313
+ int iterations = 10000 ) {
313
314
EXPECT_FALSE (MessageDifferencer::Equals (from, to));
314
315
ReducedTestMutator mutator;
315
316
std::unique_ptr<protobuf::Message> message (from.New ());
316
317
EXPECT_FALSE (MessageDifferencer::Equals (from, to));
317
- for (int j = 0 ; j < 1000000 ; ++j) {
318
+ for (int j = 0 ; j < iterations ; ++j) {
318
319
message->CopyFrom (from);
319
320
mutator.Mutate (message.get (), 1000 );
320
321
if (MessageDifferencer::Equals (*message, to)) return true ;
@@ -327,12 +328,12 @@ bool Mutate(const protobuf::Message& from, const protobuf::Message& to) {
327
328
}
328
329
329
330
bool CrossOver (const protobuf::Message& from, const protobuf::Message& with,
330
- const protobuf::Message& to) {
331
+ const protobuf::Message& to, int iterations = 10000 ) {
331
332
EXPECT_FALSE (MessageDifferencer::Equals (from, to));
332
333
ReducedTestMutator mutator;
333
334
std::unique_ptr<protobuf::Message> message (from.New ());
334
335
EXPECT_FALSE (MessageDifferencer::Equals (from, to));
335
- for (int j = 0 ; j < 1000000 ; ++j) {
336
+ for (int j = 0 ; j < iterations ; ++j) {
336
337
message->CopyFrom (from);
337
338
mutator.CrossOver (with, message.get (), 1000 );
338
339
if (MessageDifferencer::Equals (*message, to)) return true ;
@@ -440,8 +441,8 @@ TEST_P(MutatorFieldTest, Initialized) {
440
441
TEST_P (MutatorFieldTest, ChangeField) {
441
442
LoadWithChangedLine (m1_.get (), 0 );
442
443
LoadWithChangedLine (m2_.get (), 1 );
443
- EXPECT_TRUE (Mutate (*m1_, *m2_));
444
- EXPECT_TRUE (Mutate (*m2_, *m1_));
444
+ EXPECT_TRUE (Mutate (*m1_, *m2_, 1000000 ));
445
+ EXPECT_TRUE (Mutate (*m2_, *m1_, 1000000 ));
445
446
}
446
447
447
448
TEST_P (MutatorFieldTest, CrossOver) {
0 commit comments