135375f98Sopenharmony_ci 235375f98Sopenharmony_ci#include "ProductionCode.h" 335375f98Sopenharmony_ci 435375f98Sopenharmony_ciint Counter = 0; 535375f98Sopenharmony_ciint NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; /* some obnoxious array to search that is 1-based indexing instead of 0. */ 635375f98Sopenharmony_ci 735375f98Sopenharmony_ci/* This function is supposed to search through NumbersToFind and find a particular number. 835375f98Sopenharmony_ci * If it finds it, the index is returned. Otherwise 0 is returned which sorta makes sense since 935375f98Sopenharmony_ci * NumbersToFind is indexed from 1. Unfortunately it's broken 1035375f98Sopenharmony_ci * (and should therefore be caught by our tests) */ 1135375f98Sopenharmony_ciint FindFunction_WhichIsBroken(int NumberToFind) 1235375f98Sopenharmony_ci{ 1335375f98Sopenharmony_ci int i = 0; 1435375f98Sopenharmony_ci while (i < 8) /* Notice I should have been in braces */ 1535375f98Sopenharmony_ci i++; 1635375f98Sopenharmony_ci if (NumbersToFind[i] == NumberToFind) /* Yikes! I'm getting run after the loop finishes instead of during it! */ 1735375f98Sopenharmony_ci return i; 1835375f98Sopenharmony_ci return 0; 1935375f98Sopenharmony_ci} 2035375f98Sopenharmony_ci 2135375f98Sopenharmony_ciint FunctionWhichReturnsLocalVariable(void) 2235375f98Sopenharmony_ci{ 2335375f98Sopenharmony_ci return Counter; 2435375f98Sopenharmony_ci} 25