diff options
author | Omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-02-24 22:47:46 +1100 |
---|---|---|
committer | Omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-02-24 22:47:46 +1100 |
commit | 7b3afcaf77f96e7d62f6cd1623ead7f17512d79f (patch) | |
tree | b5f82c64e9c06a84e4d095ab4ac48712e860b673 /deps/Unity/examples/example_4/src | |
parent | b047be5252aeb981faea077409c1768fda0301d9 (diff) |
repo init. partial port of existing code
Diffstat (limited to 'deps/Unity/examples/example_4/src')
-rw-r--r-- | deps/Unity/examples/example_4/src/ProductionCode.c | 24 | ||||
-rw-r--r-- | deps/Unity/examples/example_4/src/ProductionCode.h | 3 | ||||
-rw-r--r-- | deps/Unity/examples/example_4/src/ProductionCode2.c | 11 | ||||
-rw-r--r-- | deps/Unity/examples/example_4/src/ProductionCode2.h | 2 | ||||
-rw-r--r-- | deps/Unity/examples/example_4/src/meson.build | 16 |
5 files changed, 56 insertions, 0 deletions
diff --git a/deps/Unity/examples/example_4/src/ProductionCode.c b/deps/Unity/examples/example_4/src/ProductionCode.c new file mode 100644 index 0000000..db128e5 --- /dev/null +++ b/deps/Unity/examples/example_4/src/ProductionCode.c @@ -0,0 +1,24 @@ + +#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; +} diff --git a/deps/Unity/examples/example_4/src/ProductionCode.h b/deps/Unity/examples/example_4/src/ProductionCode.h new file mode 100644 index 0000000..250ca0d --- /dev/null +++ b/deps/Unity/examples/example_4/src/ProductionCode.h @@ -0,0 +1,3 @@ + +int FindFunction_WhichIsBroken(int NumberToFind); +int FunctionWhichReturnsLocalVariable(void); diff --git a/deps/Unity/examples/example_4/src/ProductionCode2.c b/deps/Unity/examples/example_4/src/ProductionCode2.c new file mode 100644 index 0000000..98ee7ee --- /dev/null +++ b/deps/Unity/examples/example_4/src/ProductionCode2.c @@ -0,0 +1,11 @@ + +#include "ProductionCode2.h" + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction) +{ + (void)Poor; + (void)LittleFunction; + /* Since There Are No Tests Yet, This Function Could Be Empty For All We Know. + * Which isn't terribly useful... but at least we put in a TEST_IGNORE so we won't forget */ + return (char*)0; +} diff --git a/deps/Unity/examples/example_4/src/ProductionCode2.h b/deps/Unity/examples/example_4/src/ProductionCode2.h new file mode 100644 index 0000000..34ae980 --- /dev/null +++ b/deps/Unity/examples/example_4/src/ProductionCode2.h @@ -0,0 +1,2 @@ + +char* ThisFunctionHasNotBeenTested(int Poor, char* LittleFunction); diff --git a/deps/Unity/examples/example_4/src/meson.build b/deps/Unity/examples/example_4/src/meson.build new file mode 100644 index 0000000..10c5735 --- /dev/null +++ b/deps/Unity/examples/example_4/src/meson.build @@ -0,0 +1,16 @@ +# +# build script written by : Michael Brockus. +# github repo author: Mike Karlesky, Mark VanderVoord, Greg Williams. +# +# license: MIT +# +inc_dir = include_directories('.') +lib_list = {'a': ['ProductionCode.c' ], 'b': ['ProductionCode2.c']} + +foreach lib, src : lib_list + set_variable(lib + '_lib', + static_library(lib + '_lib', sources: src, include_directories: inc_dir)) +endforeach + +a_dep = declare_dependency(link_with: a_lib, include_directories: inc_dir) +b_dep = declare_dependency(link_with: b_lib, include_directories: inc_dir) |