From 391c9efe431b3f2a7f7b0e92db0199687cdc3af0 Mon Sep 17 00:00:00 2001 From: Richard Date: Tue, 9 Jan 2024 19:30:10 -0700 Subject: [PATCH] Add Replace Iterative For WIth Range For test file diff --- results/file-diffs/RIRF.txt | 735 ++++++++++++++++++++++++++++++++++++ 1 file changed, 735 insertions(+) create mode 100644 results/file-diffs/RIRF.txt diff --git a/results/file-diffs/RIRF.txt b/results/file-diffs/RIRF.txt new file mode 100644 index 0000000..78bd093 --- /dev/null +++ b/results/file-diffs/RIRF.txt @@ -0,0 +1,735 @@ +diff --git a/RefactorTest/ReplaceIterativeForWithRangeFor.cpp b/RefactorTest/ReplaceIterativeForWithRangeFor.cpp +index c59ff3a..6cce7e9 100644 +--- a/RefactorTest/ReplaceIterativeForWithRangeFor.cpp ++++ b/RefactorTest/ReplaceIterativeForWithRangeFor.cpp +@@ -7,57 +7,57 @@ static int fileDataImplicitSize[] = {1, 0}; + static void TestFileArrayImplicitSize() + { + // #TEST#: RIRF1 Replace iterative for with range for +- for (int i = 0; i < 2; ++i) ++ for (int &i : fileDataImplicitSize) + { +- ++fileDataImplicitSize[i]; ++ ++i; + } + require_equal(2, fileDataImplicitSize[0]); + require_equal(1, fileDataImplicitSize[1]); + + // #TEST#: RIRF2 Replace iterative for with range for +- for (int i = 0; i <= 1; ++i) ++ for (int &i : fileDataImplicitSize) + { +- --fileDataImplicitSize[i]; ++ --i; + } + require_equal(1, fileDataImplicitSize[0]); + require_equal(0, fileDataImplicitSize[1]); + + // #TEST#: RIRF3 Replace iterative for with range for +- for (int i = 1; i >= 0; --i) ++ for (int &i : fileDataImplicitSize) + { +- ++fileDataImplicitSize[i]; ++ ++i; + } + require_equal(2, fileDataImplicitSize[0]); + require_equal(1, fileDataImplicitSize[1]); + + int sum = 0; + // #TEST#: RIRF68 Replace iterative for with range for +- for (int i = 1; i > -1; --i) ++ for (int i : fileDataImplicitSize) + { +- sum += fileDataImplicitSize[i]; ++ sum += i; + } + require_equal(3, sum); + + // #TEST#: RIRF4 Replace iterative for with range for +- for (int i = 0; i < sizeof(fileDataImplicitSize) / sizeof(fileDataImplicitSize[0]); ++i) ++ for (int &i : fileDataImplicitSize) + { +- --fileDataImplicitSize[i]; ++ --i; + } + require_equal(1, fileDataImplicitSize[0]); + require_equal(0, fileDataImplicitSize[1]); + + // #TEST#: RIRF5 Replace iterative for with range for +- for (int i = 0; i <= sizeof(fileDataImplicitSize) / sizeof(fileDataImplicitSize[0]) - 1; ++i) ++ for (int &i : fileDataImplicitSize) + { +- ++fileDataImplicitSize[i]; ++ ++i; + } + require_equal(2, fileDataImplicitSize[0]); + require_equal(1, fileDataImplicitSize[1]); + + // #TEST#: RIRF6 Replace iterative for with range for +- for (int i = sizeof(fileDataImplicitSize) / sizeof(fileDataImplicitSize[0]) - 1; i >= 0; --i) ++ for (int &i : fileDataImplicitSize) + { +- --fileDataImplicitSize[i]; ++ --i; + } + require_equal(1, fileDataImplicitSize[0]); + require_equal(0, fileDataImplicitSize[1]); +@@ -69,49 +69,49 @@ void TestConstantFileArrayImplicitSize() + { + int sum = 0; + // #TEST#: RIRF7 Replace iterative for with range for +- for (int i = 0; i < 3; ++i) ++ for (int i : constantFileDataImplicitSize) + { +- sum += constantFileDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF8 Replace iterative for with range for +- for (int i = 2; i >= 0; --i) ++ for (int i : constantFileDataImplicitSize) + { +- sum += constantFileDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF9 Replace iterative for with range for +- for (int i = 2; i >= 0; --i) ++ for (int i : constantFileDataImplicitSize) + { +- sum += constantFileDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF10 Replace iterative for with range for +- for (int i = 0; i < sizeof(constantFileDataImplicitSize) / sizeof(constantFileDataImplicitSize[0]); ++i) ++ for (int i : constantFileDataImplicitSize) + { +- sum += constantFileDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF11 Replace iterative for with range for +- for (int i = 0; i <= sizeof(constantFileDataImplicitSize) / sizeof(constantFileDataImplicitSize[0]) - 1; ++i) ++ for (int i : constantFileDataImplicitSize) + { +- sum += constantFileDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF12 Replace iterative for with range for +- for (int i = sizeof(constantFileDataImplicitSize) / sizeof(constantFileDataImplicitSize[0]) - 1; i >= 0; --i) ++ for (int i : constantFileDataImplicitSize) + { +- sum += constantFileDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + } +@@ -121,9 +121,9 @@ static int fileDataExplicitSize[10] = {9, 8, 7, 6, 5, 4, 3, 2, 1}; + static void TestFileArrayExplicitSize() + { + // #TEST#: RIRF13 Replace iterative for with range for +- for (int i = 0; i < 10; ++i) ++ for (int &i : fileDataExplicitSize) + { +- ++fileDataExplicitSize[i]; ++ ++i; + } + require_equal(10, fileDataExplicitSize[0]); + require_equal(9, fileDataExplicitSize[1]); +@@ -137,9 +137,9 @@ static void TestFileArrayExplicitSize() + require_equal(1, fileDataExplicitSize[9]); + + // #TEST#: RIRF14 Replace iterative for with range for +- for (int i = 0; i <= 9; ++i) ++ for (int &i : fileDataExplicitSize) + { +- --fileDataExplicitSize[i]; ++ --i; + } + require_equal(9, fileDataExplicitSize[0]); + require_equal(8, fileDataExplicitSize[1]); +@@ -153,9 +153,9 @@ static void TestFileArrayExplicitSize() + require_equal(0, fileDataExplicitSize[9]); + + // #TEST#: RIRF15 Replace iterative for with range for +- for (int i = 9; i >= 0; --i) ++ for (int &i : fileDataExplicitSize) + { +- ++fileDataExplicitSize[i]; ++ ++i; + } + require_equal(10, fileDataExplicitSize[0]); + require_equal(9, fileDataExplicitSize[1]); +@@ -169,9 +169,9 @@ static void TestFileArrayExplicitSize() + require_equal(1, fileDataExplicitSize[9]); + + // #TEST#: RIRF16 Replace iterative for with range for +- for (int i = 0; i < sizeof(fileDataExplicitSize) / sizeof(fileDataExplicitSize[0]); ++i) ++ for (int &i : fileDataExplicitSize) + { +- --fileDataExplicitSize[i]; ++ --i; + } + require_equal(9, fileDataExplicitSize[0]); + require_equal(8, fileDataExplicitSize[1]); +@@ -185,9 +185,9 @@ static void TestFileArrayExplicitSize() + require_equal(0, fileDataExplicitSize[9]); + + // #TEST#: RIRF17 Replace iterative for with range for +- for (int i = 0; i <= sizeof(fileDataExplicitSize) / sizeof(fileDataExplicitSize[0]) - 1; ++i) ++ for (int &i : fileDataExplicitSize) + { +- ++fileDataExplicitSize[i]; ++ ++i; + } + require_equal(10, fileDataExplicitSize[0]); + require_equal(9, fileDataExplicitSize[1]); +@@ -201,9 +201,9 @@ static void TestFileArrayExplicitSize() + require_equal(1, fileDataExplicitSize[9]); + + // #TEST#: RIRF18 Replace iterative for with range for +- for (int i = sizeof(fileDataExplicitSize) / sizeof(fileDataExplicitSize[0]) - 1; i >= 0; --i) ++ for (int &i : fileDataExplicitSize) + { +- --fileDataExplicitSize[i]; ++ --i; + } + require_equal(9, fileDataExplicitSize[0]); + require_equal(8, fileDataExplicitSize[1]); +@@ -223,49 +223,49 @@ static void TestConstantFileArrayExplicitSize() + { + int sum = 0; + // #TEST#: RIRF19 Replace iterative for with range for +- for (int i = 0; i < 10; ++i) ++ for (int i : constantFileDataExplicitSize) + { +- sum += constantFileDataExplicitSize[i]; ++ sum += i; + } + require_equal(9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1, sum); + + sum = 0; + // #TEST#: RIRF20 Replace iterative for with range for +- for (int i = 9; i >= 0; --i) ++ for (int i : constantFileDataExplicitSize) + { +- sum += constantFileDataExplicitSize[i]; ++ sum += i; + } + require_equal(9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1, sum); + + sum = 0; + // #TEST#: RIRF21 Replace iterative for with range for +- for (int i = 9; i >= 0; --i) ++ for (int i : constantFileDataExplicitSize) + { +- sum += constantFileDataExplicitSize[i]; ++ sum += i; + } + require_equal(9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1, sum); + + sum = 0; + // #TEST#: RIRF22 Replace iterative for with range for +- for (int i = 0; i < sizeof(constantFileDataExplicitSize) / sizeof(constantFileDataExplicitSize[0]); ++i) ++ for (int i : constantFileDataExplicitSize) + { +- sum += constantFileDataExplicitSize[i]; ++ sum += i; + } + require_equal(9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1, sum); + + sum = 0; + // #TEST#: RIRF23 Replace iterative for with range for +- for (int i = 0; i <= sizeof(constantFileDataExplicitSize) / sizeof(constantFileDataExplicitSize[0]) - 1; ++i) ++ for (int i : constantFileDataExplicitSize) + { +- sum += constantFileDataExplicitSize[i]; ++ sum += i; + } + require_equal(9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1, sum); + + sum = 0; + // #TEST#: RIRF24 Replace iterative for with range for +- for (int i = sizeof(constantFileDataExplicitSize) / sizeof(constantFileDataExplicitSize[0]) - 1; i >= 0; --i) ++ for (int i : constantFileDataExplicitSize) + { +- sum += constantFileDataExplicitSize[i]; ++ sum += i; + } + require_equal(9 + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1, sum); + } +@@ -282,54 +282,54 @@ static void TestStackArrayImplicitSize() + { + int stackDataImplicitSize[] = {'f', 'o', 'o'}; + // #TEST#: RIRF25 Replace iterative for with range for +- for (int i = 0; i < 3; ++i) ++ for (int &i : stackDataImplicitSize) + { +- ++stackDataImplicitSize[i]; ++ ++i; + } + require_equal(int('g'), stackDataImplicitSize[0]); + require_equal(int('p'), stackDataImplicitSize[1]); + require_equal(int('p'), stackDataImplicitSize[2]); + + // #TEST#: RIRF26 Replace iterative for with range for +- for (int i = 0; i <= 2; ++i) ++ for (int &i : stackDataImplicitSize) + { +- --stackDataImplicitSize[i]; ++ --i; + } + require_equal(int('f'), stackDataImplicitSize[0]); + require_equal(int('o'), stackDataImplicitSize[1]); + require_equal(int('o'), stackDataImplicitSize[2]); + + // #TEST#: RIRF27 Replace iterative for with range for +- for (int i = 2; i >= 0; --i) ++ for (int &i : stackDataImplicitSize) + { +- ++stackDataImplicitSize[i]; ++ ++i; + } + require_equal(int('g'), stackDataImplicitSize[0]); + require_equal(int('p'), stackDataImplicitSize[1]); + require_equal(int('p'), stackDataImplicitSize[2]); + + // #TEST#: RIRF28 Replace iterative for with range for +- for (int i = 0; i < sizeof(stackDataImplicitSize) / sizeof(stackDataImplicitSize[0]); ++i) ++ for (int &i : stackDataImplicitSize) + { +- --stackDataImplicitSize[i]; ++ --i; + } + require_equal(int('f'), stackDataImplicitSize[0]); + require_equal(int('o'), stackDataImplicitSize[1]); + require_equal(int('o'), stackDataImplicitSize[2]); + + // #TEST#: RIRF29 Replace iterative for with range for +- for (int i = 0; i <= sizeof(stackDataImplicitSize) / sizeof(stackDataImplicitSize[0]) - 1; ++i) ++ for (int &i : stackDataImplicitSize) + { +- ++stackDataImplicitSize[i]; ++ ++i; + } + require_equal(int('g'), stackDataImplicitSize[0]); + require_equal(int('p'), stackDataImplicitSize[1]); + require_equal(int('p'), stackDataImplicitSize[2]); + + // #TEST#: RIRF30 Replace iterative for with range for +- for (int i = sizeof(stackDataImplicitSize) / sizeof(stackDataImplicitSize[0]) - 1; i >= 0; --i) ++ for (int &i : stackDataImplicitSize) + { +- --stackDataImplicitSize[i]; ++ --i; + } + require_equal(int('f'), stackDataImplicitSize[0]); + require_equal(int('o'), stackDataImplicitSize[1]); +@@ -341,49 +341,49 @@ static void TestConstantStackArrayImplicitSize() + int const constantStackDataImplicitSize[] = {'b', 'a', 'r'}; + int sum = 0; + // #TEST#: RIRF31 Replace iterative for with range for +- for (int i = 0; i < 3; ++i) ++ for (int i : constantStackDataImplicitSize) + { +- sum += constantStackDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('b') + int('a') + int('r'), sum); + + sum = 0; + // #TEST#: RIRF32 Replace iterative for with range for +- for (int i = 0; i <= 2; ++i) ++ for (int i : constantStackDataImplicitSize) + { +- sum += constantStackDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('b') + int('a') + int('r'), sum); + + sum = 0; + // #TEST#: RIRF33 Replace iterative for with range for +- for (int i = 2; i >= 0; --i) ++ for (int i : constantStackDataImplicitSize) + { +- sum += constantStackDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('b') + int('a') + int('r'), sum); + + sum = 0; + // #TEST#: RIRF34 Replace iterative for with range for +- for (int i = 0; i < sizeof(constantStackDataImplicitSize) / sizeof(constantStackDataImplicitSize[0]); ++i) ++ for (int i : constantStackDataImplicitSize) + { +- sum += constantStackDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('b') + int('a') + int('r'), sum); + + sum = 0; + // #TEST#: RIRF35 Replace iterative for with range for +- for (int i = 0; i <= sizeof(constantStackDataImplicitSize) / sizeof(constantStackDataImplicitSize[0]) - 1; ++i) ++ for (int i : constantStackDataImplicitSize) + { +- sum += constantStackDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('b') + int('a') + int('r'), sum); + + sum = 0; + // #TEST#: RIRF36 Replace iterative for with range for +- for (int i = sizeof(constantStackDataImplicitSize) / sizeof(constantStackDataImplicitSize[0]) - 1; i >= 0; --i) ++ for (int i : constantStackDataImplicitSize) + { +- sum += constantStackDataImplicitSize[i]; ++ sum += i; + } + require_equal(int('b') + int('a') + int('r'), sum); + } +@@ -392,9 +392,9 @@ static void TestStackArrayExplicitSize() + { + int stackDataExplicitSize[4] = {'q', 'u', 'x'}; + // #TEST#: RIRF37 Replace iterative for with range for +- for (int i = 0; i < 4; ++i) ++ for (int &i : stackDataExplicitSize) + { +- ++stackDataExplicitSize[i]; ++ ++i; + } + require_equal(int('r'), stackDataExplicitSize[0]); + require_equal(int('v'), stackDataExplicitSize[1]); +@@ -402,9 +402,9 @@ static void TestStackArrayExplicitSize() + require_equal(1, stackDataExplicitSize[3]); + + // #TEST#: RIRF38 Replace iterative for with range for +- for (int i = 0; i <= 3; ++i) ++ for (int &i : stackDataExplicitSize) + { +- --stackDataExplicitSize[i]; ++ --i; + } + require_equal(int('q'), stackDataExplicitSize[0]); + require_equal(int('u'), stackDataExplicitSize[1]); +@@ -412,9 +412,9 @@ static void TestStackArrayExplicitSize() + require_equal(0, stackDataExplicitSize[3]); + + // #TEST#: RIRF39 Replace iterative for with range for +- for (int i = 3; i >= 0; --i) ++ for (int &i : stackDataExplicitSize) + { +- ++stackDataExplicitSize[i]; ++ ++i; + } + require_equal(int('r'), stackDataExplicitSize[0]); + require_equal(int('v'), stackDataExplicitSize[1]); +@@ -422,9 +422,9 @@ static void TestStackArrayExplicitSize() + require_equal(1, stackDataExplicitSize[3]); + + // #TEST#: RIRF40 Replace iterative for with range for +- for (int i = 0; i < sizeof(stackDataExplicitSize) / sizeof(stackDataExplicitSize[0]); ++i) ++ for (int &i : stackDataExplicitSize) + { +- --stackDataExplicitSize[i]; ++ --i; + } + require_equal(int('q'), stackDataExplicitSize[0]); + require_equal(int('u'), stackDataExplicitSize[1]); +@@ -432,9 +432,9 @@ static void TestStackArrayExplicitSize() + require_equal(0, stackDataExplicitSize[3]); + + // #TEST#: RIRF41 Replace iterative for with range for +- for (int i = sizeof(stackDataExplicitSize) / sizeof(stackDataExplicitSize[0]) - 1; i >= 0; --i) ++ for (int &i : stackDataExplicitSize) + { +- ++stackDataExplicitSize[i]; ++ ++i; + } + require_equal(int('r'), stackDataExplicitSize[0]); + require_equal(int('v'), stackDataExplicitSize[1]); +@@ -442,9 +442,9 @@ static void TestStackArrayExplicitSize() + require_equal(1, stackDataExplicitSize[3]); + + // #TEST#: RIRF42 Replace iterative for with range for +- for (int i = sizeof(stackDataExplicitSize) / sizeof(stackDataExplicitSize[0]) - 1; i >= 0; --i) ++ for (int &i : stackDataExplicitSize) + { +- --stackDataExplicitSize[i]; ++ --i; + } + require_equal(int('q'), stackDataExplicitSize[0]); + require_equal(int('u'), stackDataExplicitSize[1]); +@@ -457,49 +457,49 @@ static void TestConstantStackArrayExplicitSize() + int const constantStackdataExlicitSize[4] = {'s', 'o', 'x'}; + int sum = 0; + // #TEST#: RIRF43 Replace iterative for with range for +- for (int i = 0; i < 4; ++i) ++ for (int i : constantStackdataExlicitSize) + { +- sum += constantStackdataExlicitSize[i]; ++ sum += i; + } + require_equal(int('s') + int('o') + int('x'), sum); + + sum = 0; + // #TEST#: RIRF44 Replace iterative for with range for +- for (int i = 0; i <= 3; ++i) ++ for (int i : constantStackdataExlicitSize) + { +- sum += constantStackdataExlicitSize[i]; ++ sum += i; + } + require_equal(int('s') + int('o') + int('x'), sum); + + sum = 0; + // #TEST#: RIRF45 Replace iterative for with range for +- for (int i = 3; i >= 0; --i) ++ for (int i : constantStackdataExlicitSize) + { +- sum += constantStackdataExlicitSize[i]; ++ sum += i; + } + require_equal(int('s') + int('o') + int('x'), sum); + + sum = 0; + // #TEST#: RIRF46 Replace iterative for with range for +- for (int i = 0; i < sizeof(constantStackdataExlicitSize) / sizeof(constantStackdataExlicitSize[0]); ++i) ++ for (int i : constantStackdataExlicitSize) + { +- sum += constantStackdataExlicitSize[i]; ++ sum += i; + } + require_equal(int('s') + int('o') + int('x'), sum); + + sum = 0; + // #TEST#: RIRF47 Replace iterative for with range for +- for (int i = 0; i <= sizeof(constantStackdataExlicitSize) / sizeof(constantStackdataExlicitSize[0]) - 1; ++i) ++ for (int i : constantStackdataExlicitSize) + { +- sum += constantStackdataExlicitSize[i]; ++ sum += i; + } + require_equal(int('s') + int('o') + int('x'), sum); + + sum = 0; + // #TEST#: RIRF48 Replace iterative for with range for +- for (int i = sizeof(constantStackdataExlicitSize) / sizeof(constantStackdataExlicitSize[0]) - 1; i >= 0; --i) ++ for (int i : constantStackdataExlicitSize) + { +- sum += constantStackdataExlicitSize[i]; ++ sum += i; + } + require_equal(int('s') + int('o') + int('x'), sum); + } +@@ -527,57 +527,57 @@ static void TestContainersWithIterators() + + int sum = 0; + // #TEST#: RIRF49 Replace iterative for with range for +- for (std::vector::const_iterator it = c.cbegin(), end = c.cend(); it != end; ++it) ++ for (int it : c) + { +- sum += *it; ++ sum += it; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF50 Replace iterative for with range for +- for (std::vector::const_iterator it = c.cbegin(), end = c.cend(); end != it; ++it) ++ for (int it : c) + { +- sum += *it; ++ sum += it; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF51 Replace iterative for with range for +- for (std::vector::const_reverse_iterator it = c.crbegin(), end = c.crend(); end != it; ++it) ++ for (int it : c) + { +- sum += *it; ++ sum += it; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF52 Replace iterative for with range for +- for (std::vector::const_iterator it = c.cbegin(), end = c.cend(); end != it; ++it) ++ for (int it : c) + { +- sum += *it; ++ sum += it; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF53 Replace iterative for with range for +- for (std::vector::reverse_iterator it = c.rbegin(), end = c.rend(); it != end; ++it) ++ for (int it : c) + { +- sum += *it; ++ sum += it; + } + require_equal(int('f') + int('o') + int('o'), sum); + + // #TEST#: RIRF54 Replace iterative for with range for +- for (std::vector::iterator it = c.begin(), end = c.end(); it != end; ++it) ++ for (int &it : c) + { +- ++*it; ++ ++it; + } + require_equal(int('g'), c[0]); + require_equal(int('p'), c[1]); + require_equal(int('p'), c[2]); + + // #TEST#: RIRF55 Replace iterative for with range for +- for (std::vector::reverse_iterator it = c.rbegin(), end = c.rend(); it != end; ++it) ++ for (int &it : c) + { +- --*it; ++ --it; + } + require_equal(int('f'), c[0]); + require_equal(int('o'), c[1]); +@@ -593,25 +593,25 @@ static void TestContainersWithSubscriptUsingSizeType() + + int sum = 0; + // #TEST#: RIRF56 Replace iterative for with range for +- for (std::vector::size_type i = 0; i < c.size(); ++i) ++ for (int i : c) + { +- sum += c[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF57 Replace iterative for with range for +- for (std::vector::size_type i = 0, size = c.size(); i < size; ++i) ++ for (int i : c) + { +- sum += c[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF58 Replace iterative for with range for +- for (std::vector::size_type i = 0, size = c.size() - 1; i <= size; ++i) ++ for (int i : c) + { +- sum += c[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + } +@@ -625,25 +625,25 @@ static void TestContainersWithSubscriptUsingInt() + + int sum = 0; + // #TEST#: RIRF59 Replace iterative for with range for +- for (int i = 0; i < int(c.size()); ++i) ++ for (int i : c) + { +- sum += c[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF60 Replace iterative for with range for +- for (int i = 0, size = int(c.size()); i < size; ++i) ++ for (int i : c) + { +- sum += c[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF61 Replace iterative for with range for +- for (int i = int(c.size()) - 1; i >= 0; --i) ++ for (int i : c) + { +- sum += c[i]; ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + } +@@ -663,25 +663,25 @@ static void TestContainersWithAtUsingSizeType() + + int sum = 0; + // #TEST#: RIRF62 Replace iterative for with range for +- for (std::vector::size_type i = 0; i < c.size(); ++i) ++ for (int i : c) + { +- sum += c.at(i); ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF63 Replace iterative for with range for +- for (std::vector::size_type i = 0, size = c.size(); i < size; ++i) ++ for (int i : c) + { +- sum += c.at(i); ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF64 Replace iterative for with range for +- for (std::vector::size_type i = 0, size = c.size() - 1; i <= size; ++i) ++ for (int i : c) + { +- sum += c.at(i); ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + } +@@ -695,25 +695,25 @@ static void TestContainersWithAtUsingInt() + + int sum = 0; + // #TEST#: RIRF65 Replace iterative for with range for +- for (int i = 0; i < int(c.size()); ++i) ++ for (int i : c) + { +- sum += c.at(i); ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF66 Replace iterative for with range for +- for (int i = 0, size = int(c.size()); i < size; ++i) ++ for (int i : c) + { +- sum += c.at(i); ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + + sum = 0; + // #TEST#: RIRF67 Replace iterative for with range for +- for (int i = int(c.size()) - 1; i >= 0; --i) ++ for (int i : c) + { +- sum += c.at(i); ++ sum += i; + } + require_equal(int('f') + int('o') + int('o'), sum); + }