Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 5, 2015, 10:47:51 PM (9 years ago)
Author:
landauf
Message:

use range-based for-loop where it makes sense (e.g. ObjectList)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/cpp11_v2/test/util/MathTest.cc

    r9114 r10919  
    245245
    246246        // all numbers must satisfy 0 <= <number> < 1
    247         for (std::set<float>::iterator it = numbers.begin(); it != numbers.end(); ++it)
     247        for (float number : numbers)
    248248        {
    249             EXPECT_LE(min, *it);
    250             EXPECT_GT(max, *it);
     249            EXPECT_LE(min, number);
     250            EXPECT_GT(max, number);
    251251        }
    252252    }
     
    268268
    269269        // all numbers must satisfy 0 <= <number> < <max>
    270         for (std::set<float>::iterator it = numbers.begin(); it != numbers.end(); ++it)
     270        for (float number : numbers)
    271271        {
    272             EXPECT_LE(min, *it);
    273             EXPECT_GT(max, *it);
     272            EXPECT_LE(min, number);
     273            EXPECT_GT(max, number);
    274274        }
    275275    }
     
    291291
    292292        // all numbers must satisfy <min> <= <number> < <max>
    293         for (std::set<float>::iterator it = numbers.begin(); it != numbers.end(); ++it)
     293        for (float number : numbers)
    294294        {
    295             EXPECT_LE(min, *it);
    296             EXPECT_GT(max, *it);
     295            EXPECT_LE(min, number);
     296            EXPECT_GT(max, number);
    297297        }
    298298    }
     
    315315
    316316        // all numbers must be either 1 oder -1
    317         for (std::set<float>::iterator it = numbers.begin(); it != numbers.end(); ++it)
    318             EXPECT_TRUE(*it == 1 || *it == -1);
     317        for (float number : numbers)
     318            EXPECT_TRUE(number == 1 || number == -1);
    319319    }
    320320
Note: See TracChangeset for help on using the changeset viewer.