#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "glbopts.h"
#include <math.h>
#include "linAlg.h"
Go to the source code of this file.
|
#define | true 1 |
|
#define | false 0 |
|
#define | TEST_SUCCESS 0 |
|
#define | TEST_FAILURE 1 |
|
#define | MESSAGE_OK "OK" |
|
#define | TEST_PASS_FLAG "\x1B[92m[PASS]\x1B[39m " |
|
#define | TEST_FAIL_FLAG "\x1B[31m<FAIL>\x1B[39m " |
|
#define | TEST_MESSAGE_BUFF_SIZE 500 |
|
#define | TEST_ERROR_MESSAGE_SIZE 100 |
|
#define | FAIL_WITH_MESSAGE(str, message) |
|
#define | ASSERT_TRUE_OR_FAIL(p, str, message) |
|
#define | ASSERT_EQUAL_INT_OR_FAIL(val, expected, str, message) |
|
#define | ASSERT_EQUAL_FLOAT_OR_FAIL(val, expected, tol, str, message) |
|
#define | ASSERT_EQUAL_ARRAY_OR_FAIL(val, expected, len, tol, str, message) |
|
#define | ASSERT_EQUAL_ARRAY_INT_OR_FAIL(val, expected, len, str, message) |
|
#define | SUCCEED(str) |
|
#define ASSERT_EQUAL_ARRAY_INT_OR_FAIL |
( |
|
val, |
|
|
|
expected, |
|
|
|
len, |
|
|
|
str, |
|
|
|
message |
|
) |
| |
Value:
}
bool scs_assert_equals_array_int(const scs_int *a, const scs_int *b, scs_int n)
#define FAIL_WITH_MESSAGE(str, message)
Definition: unit_test_util.h:72
int number_of_assertions
Definition: unit_test_util.h:60
Check whether two arrays are equal, or fail with a given message.
#define ASSERT_EQUAL_ARRAY_OR_FAIL |
( |
|
val, |
|
|
|
expected, |
|
|
|
len, |
|
|
|
tol, |
|
|
|
str, |
|
|
|
message |
|
) |
| |
Value:
}
bool scs_assert_equals_array(const scs_float *a, const scs_float *b, scs_int n, const scs_float tol)
#define FAIL_WITH_MESSAGE(str, message)
Definition: unit_test_util.h:72
int number_of_assertions
Definition: unit_test_util.h:60
Check whether two arrays are equal, or fail with a given message.
#define ASSERT_EQUAL_FLOAT_OR_FAIL |
( |
|
val, |
|
|
|
expected, |
|
|
|
tol, |
|
|
|
str, |
|
|
|
message |
|
) |
| |
Value:
sprintf(error_msg, "\n\tExpected: %g, Actual %g (tol=%g)", expected, val, tol);\
}
#define TEST_ERROR_MESSAGE_SIZE
Definition: unit_test_util.h:68
bool scs_assert_equals_float(const scs_float a, const scs_float b, const scs_float tol)
#define FAIL_WITH_MESSAGE(str, message)
Definition: unit_test_util.h:72
int number_of_assertions
Definition: unit_test_util.h:60
#define TEST_MESSAGE_BUFF_SIZE
Definition: unit_test_util.h:67
Check whether two integers are equal, or fail with a given message.
#define ASSERT_EQUAL_INT_OR_FAIL |
( |
|
val, |
|
|
|
expected, |
|
|
|
str, |
|
|
|
message |
|
) |
| |
Value:
{\
sprintf(error_msg, "\n\tExpected: %d, Actual %d", expected, val);\
}\
}
#define TEST_ERROR_MESSAGE_SIZE
Definition: unit_test_util.h:68
#define FAIL_WITH_MESSAGE(str, message)
Definition: unit_test_util.h:72
int number_of_assertions
Definition: unit_test_util.h:60
#define TEST_MESSAGE_BUFF_SIZE
Definition: unit_test_util.h:67
bool scs_assert_equals_int(const scs_int a, const scs_int b)
Check whether two integers are equal, or fail with a given message.
#define ASSERT_TRUE_OR_FAIL |
( |
|
p, |
|
|
|
str, |
|
|
|
message |
|
) |
| |
Value:
}
#define FAIL_WITH_MESSAGE(str, message)
Definition: unit_test_util.h:72
int number_of_assertions
Definition: unit_test_util.h:60
#define FAIL_WITH_MESSAGE |
( |
|
str, |
|
|
|
message |
|
) |
| |
Value:*str = (char*)(message);\
#define TEST_FAILURE
Definition: unit_test_util.h:63
Fails with a given message.
a message returned when a test is successful
Value:
#define MESSAGE_OK
Definition: unit_test_util.h:64
#define TEST_SUCCESS
Definition: unit_test_util.h:62
Succeed
#define TEST_ERROR_MESSAGE_SIZE 100 |
#define TEST_FAIL_FLAG "\x1B[31m<FAIL>\x1B[39m " |
#define TEST_MESSAGE_BUFF_SIZE 500 |
#define TEST_PASS_FLAG "\x1B[92m[PASS]\x1B[39m " |
typedef bool(* unitTest_t)(char **) |
Function template defining a unit test:
int myTestFunction(char**);
This type is a pointer to such a function which takes as an input argument a pointer to a string (char**) and returns a status code (either TEST_SUCCESS or TEST_FAILURE).
Checks whether two arrays of float are equal, element-wise, up to a certain tolerance.
- Parameters
-
a | first array |
b | second array |
n | length of array |
tol | tolerance |
- Returns
true
is the two arrays are equal
Checks whether two arrays of float are equal, element-wise, up to a certain tolerance.
- Parameters
-
a | first array |
b | second array |
n | length of array |
- Returns
true
is the two arrays are equal
Assert that two floats are equal up to a given tolerance.
- Parameters
-
- Returns
Assert that two integers are equal.
- Parameters
-
- Returns
Tester function.
- Parameters
-
ut | Unit Test function handle |
name | Name of the test |
- Returns
- TEST_SUCCESS if the test succeeds and TEST_FAILURE if it fails.