Sha256: 29d42fce2d89d95fb2b14b649d3b2d7406d225a071e01e86d6ec0cdb04c7e614

Contents?: true

Size: 862 Bytes

Versions: 30

Compression:

Stored size: 862 Bytes

Contents

#include "ProductionCode.h"

int Counter = 0;
int NumbersToFind[9] = { 0, 34, 55, 66, 32, 11, 1, 77, 888 }; /* some obnoxious array to search that is 1-based indexing instead of 0. */

/* This function is supposed to search through NumbersToFind and find a particular number.  
 * If it finds it, the index is returned.  Otherwise 0 is returned which sorta makes sense since 
 * NumbersToFind is indexed from 1.  Unfortunately it's broken 
 * (and should therefore be caught by our tests) */
int FindFunction_WhichIsBroken(int NumberToFind)
{
    int i = 0;
    while (i <= 8) /* Notice I should have been in braces */
        i++;
        if (NumbersToFind[i] == NumberToFind) /* Yikes!  I'm getting run after the loop finishes instead of during it! */
            return i;
    return 0;
}

int FunctionWhichReturnsLocalVariable(void)
{
    return Counter;
}

Version data entries

30 entries across 10 versions & 2 rubygems

Version Path
simdjson-0.3.0 vendor/simdjson/dependencies/cJSON/tests/unity/examples/example_1/src/ProductionCode.c
ceedling-0.30.0 vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.30.0 vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.28.3 vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.28.3 vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.28.2 vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.28.1 vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.28.1 vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.28.1 vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.28.1 vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.27.0 vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.27.0 vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.27.0 vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.27.0 vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.25.0 vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.25.0 vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.25.0 vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.25.0 vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.24.0 vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c
ceedling-0.24.0 vendor/unity/examples/example_1/src/ProductionCode.c