| 121 | } |
| 122 | |
| 123 | void setAPI(ScriptAPI api, const char* searchPath) |
| 124 | { |
| 125 | if (api != API_UNKNOWN) |
| 126 | { |
| 127 | s_api = ScriptAPI(api | API_SHARED); |
| 128 | } |
| 129 | s_searchPath = searchPath; |
| 130 | |
| 131 | // Automatically run tests if enabled, this will write the results to the console and |
| 132 | // Output window in Visual Studio. |
| 133 | #if RUN_SCRIPT_TESTS == 1 |
| 134 | const size_t testCount = TFE_ARRAYSIZE(c_scriptTests); |
| 135 | char path[TFE_MAX_PATH]; |
| 136 | for (size_t i = 0; i < testCount; i++) |
| 137 | { |
| 138 | const char* name = c_scriptTests[i]; |
| 139 | sprintf(path, "ScriptTests/%s.fs", name); |
| 140 | |
| 141 | TFE_ForceScript::ModuleHandle scriptMod = TFE_ForceScript::getModule(name); |
| 142 | if (!scriptMod) |
| 143 | { |
| 144 | scriptMod = TFE_ForceScript::createModule(name, path, false, s_api); |
| 145 | } |
| 146 | if (scriptMod) |
| 147 | { |
| 148 | TFE_ForceScript::FunctionHandle func = TFE_ForceScript::findScriptFuncByName(scriptMod, "main"); |
| 149 | if (func) |
| 150 | { |
| 151 | TFE_ForceScript::execFunc(func); |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | #endif |
| 156 | } |
| 157 | |
| 158 | void reset() |
| 159 | { |
no test coverage detected