Sha256: 85bd096a3ecd02bbc45274a21ffd377eb7413c4e5f946113708bab8c50510a06

Contents?: true

Size: 1.14 KB

Versions: 8

Compression:

Stored size: 1.14 KB

Contents

/* =========================================================================
    Unity - A Test Framework for C
    ThrowTheSwitch.org
    Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
    SPDX-License-Identifier: MIT
========================================================================= */

#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

8 entries across 2 versions & 1 rubygems

Version Path
ceedling-1.0.1 vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c
ceedling-1.0.1 vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c
ceedling-1.0.1 vendor/unity/examples/example_2/src/ProductionCode.c
ceedling-1.0.1 vendor/unity/examples/example_3/src/ProductionCode.c
ceedling-1.0.0 vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c
ceedling-1.0.0 vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c
ceedling-1.0.0 vendor/unity/examples/example_2/src/ProductionCode.c
ceedling-1.0.0 vendor/unity/examples/example_3/src/ProductionCode.c