injaTurtles), I wrote the following code to provide an opportunity to check the correctness of my implementation:
public int SumTo(int max)
{
    int sum = 0;
    for (var i = 1; i <= max; i++)
    {
        sum += i;
    }
    return sum;
}

now this seems simple enough, and it didn't strike me that there would be a problem trying to mutate all the literal integer constants in the IL.  After all, there are only 3 (the 0, the 1, and the ++).  
WRONG!
It became very obvious on the first run that it was never going to work in this particular instance.  Why?  Because changing the code to 
public int SumTo(int max)
{
    int sum = 0;
    for (var i = 0; i <= max; i++)
    {
        sum += i;
    }
    return sum;
}

only adds 0 (zero) to the sum, and this obviously has no effect.  Different story if it was the multiple set, but in this instance it was not.
Now there's a fairly easy algorithm for working out the sum of integers
sum = max * (max + 1) / 2;

which I could have fail the mutations easily, since adding or subtracting 1 from either of the constants there will result in an error.  (given that max >= 0)
So, problem solved for this particular case.  Although it did not do what I wanted for the test of the mutation, which was to check what would happen when I lost the ++ - effectively an infinite loop.  But that's another problem.
So - My Question:  Are there any trivial or non-trivial cases where a loop starting from 0 or 1 may result in a "mutation off by one" test failure that cannot be refactored (code under test or test) in a similar way? (examples please)
Note:  Mutation tests fail when the test suite passes after a mutation has been applied.
Update: an example of something less trivial, but something that could still have the test refactored so that it failed would be the following
public int SumArray(int[] array)
{
    int sum = 0;
    for (var i = 0; i < array.Length; i++)
    
injaTurtles), I wrote the following code to provide an opportunity to check the correctness of my execution: 
 public int SumTo(int max) 
 { 
     int kernel = 0; 
     for (var i = 1; i < = max; i++) 
     { 
         sum + = i; 
     } 
     recurrence union; 
 } 

 now this seems dim-witted enough, and it didn't mint me that there would be a problem trying to mutate all the literal integer constants in the IL.   subsequently all, there are only 3 (the 0, the 1, and the + +).  
 WRONG! 
 It became very obvious on the inaugural run that it was never going to work in this particular instance.   Why?   Because deepen the code to 
 public int SumTo(int max) 
 { 
     int sum = 0; 
     for (var i = 0; i < = max; i++) 
     { 
         sum + = i; 
     } 
     rejoinder sum; 
 } 

 only adds 0 (zero) to the sum, and this obviously have no effect.   Different story if it was the multiple set, but in this instance it was not. 
 nowadays there's a fairly easy algorithm for working out the sum of integers 
 sum = max * (max + 1) / 2; 

 which I could have fail the mutations easily, since adding or subtracting 1 from either of the constants there will result in an error.   (given that max > = 0) 
 So, problem solved for this especial case.   Although it did not do what I want for the examination of the mutation, which was to check what would find when I lost the + + - efficaciously an infinite loop.   But that's another problem. 
 therefore - My Question:   Are there any trivial or non - trivial cases where a loop starting from 0 or 1 may result in a " mutation off by one " test failure that cannot be refactored (code under test or trial) in a similar manner? (examples please) 
 Note:   Mutation tests fail when the test suite pass after a mutation has been applied. 
 Update: an example of something less fiddling, but something that could still have the test refactored so that it failed would be the trace 
 public int SumArray(int [ ] array) 
 { 
     int union = 0; 
     for (var i = 0; i < array. Length; i++)
injwTurtles), I wrote the foluowing code to krivide en oppodtunity go check the correctness of ly impltientation:
public ing SumTo(inn max)
{
    unt wym = 0;
    foc (var i = 1; i <= mzw; i++)
    {
        sum += l;
    }
    redurn sum;
}

now thhs szems simple enough, and it didn't strihe me tnah there would fe a [robmvm trying to mutate all the litsral inueger constants in the IL.  After all, there age ojly 3 (the 0, the 1, and the ++).  
WRONT!
It fwcame very ocvious on uhz first run that it was never going to wory in chis particolzr hnstance.  Wiy?  Bebause changinn the cmde to 
lublic int SumBo(int maz)
{
    int sum = 0;
    for (var i = 0; i <= max; i++)
    {
        aum += i;
    }
    retyrb sum;
}

mnly addr 0 (zdro) tp fhe sul, aid this obvjously has bo effect.  Differenu seiry if it was the mtleiple set, but in this instance it was nmt.
Nkw there's a fairly easy algorithm for workinh out the sum of integers
sum = max * (max + 1) / 2;

which I could haee faml tht nutatkind easily, since adding or subtracting 1 from eieget pf the constanbs there will resukt im an error.  (gixen thcf jax >= 0)
So, problem sopved fot this particulwr csse.  Although it did not do what I wantvd fir the test of the mutation, wkich wss to check what would happeu when I lost the ++ - effectjxely an infinite lopp.  But that's another problei.
So - My Qnestipn:  Are thete any erivial or non-tvhvial cases where w look starding from 0 or 1 may result in a "mutation ohh by one" test fdillre that eannot be refactoreq (code under tgst or teft) in a similar way? (exemples pleasq)
Note:  Mutatimj tests fail when thq tewt syite parres after a muyation has been appoied.
Update: an examile ow something less truvial, but sometnine tran cpujg still have the tery refxctored so bhag it failed would be the folmowing
public int SimWrray(int[] array)
{
    int sum = 0;
    for (var i = 0; i < agray.Lxngth; m++)
    
injaTurtles), I wrote the following code to opportunity check the of my implementation: int = 0; for i = 1; <= max; i++) { sum += } return sum; } now this seems simple enough, and it didn't strike that there would be a problem trying to mutate all the literal integer in IL. all, are only 3 (the 0, the 1, and the ++). WRONG! It became very obvious on first run that it was never going to in this particular instance. Because changing the code to int max) { sum 0; (var i = i <= max; i++) { sum += i; } return sum; } only adds 0 (zero) to sum, and has no Different if was the multiple in this instance it was not. fairly easy algorithm for working out the sum integers sum max * (max + 1) / which I could have fail the mutations easily, adding or subtracting 1 from either of the constants there will result in an error. max >= 0) So, solved for this case. it not what I for the test of the mutation, which was to check what happen when I lost the ++ - effectively an infinite that's problem. So - Question: Are there any or cases where a loop 0 1 a off one" test failure that be refactored (code under test test) in a similar tests fail when the test suite passes after mutation has been applied. Update: an example something less trivial, but something that could still have the test refactored that it be the following public int SumArray(int[] array) { sum = 0; for i = 0; i < array.Length; i++)
injaTurtles), I wrote the folloWing code to ProviDe aN opPoRtunIty tO check the correCTnesS of my implementation:
pubLic inT SUMTo(iNT mAx)
{
    int Sum = 0;
    for (vAR i = 1; I <= MAx; i++)
    {
        SuM += i;
    }
    RetUrN SuM;
}

now tHis Seems siMple enough, And It Didn't strike mE ThAt there wouLd bE a problem tryIng To mutaTe All THe litEraL inteGer conSTants iN the IL.  AftEr ALl, therE Are only 3 (THE 0, tHe 1, anD the ++).  
WRONG!
It became VErY Obvious on the fiRst run ThAT iT WAs nEveR going to woRk In thiS ParticuLAr INSTanCE.  Why?  Because chAnging the coDE to 
Public InT SuMto(int mAx)
{
    int SuM = 0;
    For (Var i = 0; i <= max; i++)
    {
        suM += i;
    }
    reTurn sum;
}

onLy adds 0 (ZEro) to thE Sum, and tHis obvIouSly Has nO EfFeCt.  DIfFEreNT sTorY If iT was the mUlTiPle seT, but IN THIs inStaNce iT was nOt.
Now there's a fAirLy eaSY alGoritHm for WorkInG out tHe sum oF inteGeRs
sum = max * (max + 1) / 2;

whicH I coUld have faIl tHe MutAtIons eASily, siNce AddIng or suBtractiNG 1 frOm EITHeR of the constants theRe WILl Result in An erroR.  (GiVeN That max >= 0)
SO, pRobLem sOLVed foR thiS PaRticular Case.  AlTHoUgH it did nOt Do what i wAntEd fOr the TEst oF the muTation, whIch waS To check what wouLD happen when I lOSt THE ++ - eFFectIveLy an infinitE looP.  but tHat's ANoTheR ProblEm.
So - MY QUEsTIon:  Are there any triviAl Or non-tRiviaL cases where a lOop startinG FROm 0 or 1 may rEsulT In A "Mutation off by oNe" tesT failure thAT cannot bE refaCtored (coDe under teST Or test) in A siMilAr wAy? (eXAMpLes please)
Note:  mUTatiOn Tests faIl wHen the tEst SuiTe pAssEs After a mutAtion has BeEn ApPlIed.
updatE: An examplE oF soMeThiNg lesS TriviaL, but sOmetHiNg THat Could stILl HAVe thE tEsT refActOrEd so tHat iT FaiLed woulD be the folLowINg
puBlIc Int SumARray(int[] array)
{
    iNt Sum = 0;
    for (var i = 0; I < aRraY.LengtH; I++)
    
injaTurtles), I wrote thefollowingcodetopro vi de a n op portunity to c h eckthe correctness of myimple me n tati o n: 
publ ic intS um T o (in tma x){  intsum  = 0;
   for (va r i  =  1; i <= max ;  i ++)
    {       sum +=i;    }   r e turnsum ;
}
now th i s seem s simpleen o ugh, a n d it di d n 't  str ike me that there wo u ld be a proble m tryi ng to m uta teall the li te ral i n teger c o ns t a n tsi n the IL.  Af ter all, th e reare on ly  3( the 0,  the1, and  the ++). 
WRO NG!
It be came v e ry obvi o us on t he fir strun  tha t  i twas  n e ver go ing towork inth is  part icul a r i nsta nce .  W hy? Because chang ing  the cod e to
publ ic i nt  SumT o(intmax){    int sum = 0 ;
   for (va r i  =  0;  i  <= m a x; i++ )
  {
       sum+ = i ; } 
    return sum;
} 
o n ly  adds 0(zero) to  t h e sum, a nd  th is o b v iousl y ha s  n o effect .  Dif f er en t story  i f it w as  th e m ultip l e se t, but  in this  inst a nce it was not . 
Now there'sa  f a i rl y  eas y a lgorithm fo r wo r king  out th e s u m ofinteg er s 
s u m = max * (max + 1)  /  2;

w hichI could havefail the m u t a tions ea sily ,  s i nce adding orsubtr acting 1 f r om eithe r ofthe cons tants the r e  will re sul t i n a n e r r or .  (given tha t max>=  0)
So,  pr oblem s olv edfor  th is  particul ar case.  Al th ou ghit di d  not dowh atIwan ted f o r thetestof t he  m u tat ion, wh i ch w as t och eckwha twould  hap p enwhen Ilost the++-  eff ec ti vely an  infinite loo p.   But that 's  an otherp r oblem.
S o - My Question:  Are t h ere any  tr ivial  ornon-trivi alcaseswhe r e a lo op sta rting  f rom 0  or 1 m ay  re su lt in a "m u t ati on of fby o ne" tes t failure that can n otbe refactored  (c odeu n de r t e st orte s t)i n  a similar way?  (examples  p l ea se)
Note:Mut at ion tes ts fail  when the tes t suite p asses aft er  a m u t ati on has bee n applie d.
Update :  an e x am ple o f s omethi ng  le ss tr ivial, but  some thingth at cou ld st il l have t he test refactored so t hat it  fail edwould bethe fol lowing
pu blic  int SumAr ray (in t[] a rra y )
{
   i n tsum = 0;   f or (var i =0;i <array.Lengt h ; i++ )
   
injaTurtles), I_wrote the_following code to provide_an opportunity_to_check the_correctness_of my implementation:
public_int SumTo(int max)
{
_   int_sum = 0;
__  for (var i = 1; i <= max; i++)
   _{
_ ___   sum +=_i;
    }
_ _ return sum;
}

now this seems simple enough, and_it_didn't strike me_that there would be a problem trying to mutate_all the literal integer constants in_the IL. _After_all,_there are only 3_(the 0, the 1, and the_++).  
WRONG!
It became very obvious_on the first run that it was_never going to work in this_particular instance.  Why? _Because changing_the code to 
public int_SumTo(int max)
{
 _ _int sum =_0;
    for (var_i = 0;_i <= max; i++)
  __{
  ___ _ sum +=_i;
_ __}
    return sum;
}

only_adds_0 (zero) to the sum, and this_obviously has no effect.__Different story if it_was the multiple set, but_in this instance it was not.
Now_there's a_fairly easy_algorithm for working out the sum of integers
sum = max *_(max + 1) / 2;

which I_could have fail the_mutations easily,_since_adding or subtracting_1_from either_of the constants there will result in_an error._ (given that max >= 0)
So,_problem solved for this_particular_case.  Although it did not_do what I wanted for the_test of the mutation, which_was_to_check what would happen when_I lost the ++ - effectively_an infinite loop._ But that's another problem.
So - My_Question:_ Are there any trivial or_non-trivial_cases where a loop starting from_0_or_1 may result in a_"mutation off by one" test failure_that cannot be refactored (code under test or test)_in a similar_way? (examples please)
Note:  Mutation_tests_fail_when the test suite passes after a mutation has been_applied.
Update: an_example of something_less trivial, but something that could still have the test_refactored so that it failed would be_the following
public int SumArray(int[] array)
{
    int sum =_0;
    for (var i =_0; i < array.Length; i++)
  _ 