49 return slope * x - 1.4f;
62 return ((x - 2.0
f) * (x - 2.0
f) + 3.0
f);
106 ut_assert(
"linear function opt not equal min ", fabsf(opt - a) <= (tol * 2.0
f));
107 ut_assert(
"quad function opt not equal min ", fabsf(opt2 - 2.0f) <= (tol * 2.0f));
118 float (*fun2)(float);
126 ut_assert(
"linear function opt not equal min", fabsf(opt - b) <= (tol * 2.0
f));
127 ut_assert(
"quad function opt not equal min ", fabsf(opt2 - 2.0f) <= (tol * 2.0f));
138 float (*fun2)(float);
146 ut_assert(
"linear function opt not equal min", fabsf(opt - a) <= (tol * 2.0
f));
147 ut_assert(
"quad function opt not equal min ", fabsf(opt2 - b) <= (tol * 2.0f));
158 float (*fun2)(float);
166 ut_assert(
"linear function opt not equal min", fabsf(opt - (b + a) / 2.0
f) <= (0.001
f * 2.0
f));
167 ut_assert(
"quad function opt not equal min ", fabsf(opt2 - (b + a) / 2.0f) <= (0.001f * 2.0f));
178 float (*fun2)(float);
186 ut_assert(
"linear function opt not equal min", fabsf(opt - (b + a) / 2.0
f) <= (0.001
f * 2.0
f));
187 ut_assert(
"quad function opt not equal min ", fabsf(opt2 - (b + a) / 2.0f) <= (0.001f * 2.0f));
201 ut_assert(
"linear function function opt not equal min", fabsf(fun(opt) - fun(b)) <= (tol));
bool _init_inputs_negative()
bool _init_tol_larger_than_range_flipped()
#define ut_declare_test_c(test_function, test_class)
float _linear_function(float x)
Base class to be used for unit tests.
bool _init_inputs_flipped()
float _quadratic_function(float x)
const _Tp goldensection(const _Tp &arg1, const _Tp &arg2, _Tp(*fun)(_Tp), const _Tp &tol)
int _tests_failed
The number of unit tests which failed.
bool _init_tol_larger_than_range()
#define ut_assert(message, test)
Used to assert a value within a unit test.
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
float _linear_function_flat(float x)
virtual bool run_tests()
Override to run your unit tests.
#define ut_run_test(test)
Runs a single unit test.
int test_search_min(int argc, char *argv[])