Fix file and directory permissions
This commit is contained in:
0
.gitignore
vendored
Executable file → Normal file
0
.gitignore
vendored
Executable file → Normal file
0
include/BH/Algo.h
Executable file → Normal file
0
include/BH/Algo.h
Executable file → Normal file
0
include/BH/Hashmap.h
Executable file → Normal file
0
include/BH/Hashmap.h
Executable file → Normal file
0
include/BH/Queue.h
Executable file → Normal file
0
include/BH/Queue.h
Executable file → Normal file
0
src/Algo.c
Executable file → Normal file
0
src/Algo.c
Executable file → Normal file
0
src/Hashmap.c
Executable file → Normal file
0
src/Hashmap.c
Executable file → Normal file
0
src/Queue.c
Executable file → Normal file
0
src/Queue.c
Executable file → Normal file
0
test/CMakeLists.txt
Executable file → Normal file
0
test/CMakeLists.txt
Executable file → Normal file
@@ -408,6 +408,47 @@ static int checkVec2i(void)
|
||||
|
||||
static int checkQuat(void)
|
||||
{
|
||||
float a[4], b[3], r[4];
|
||||
float roll, pitch, yaw, angle;
|
||||
|
||||
a[0] = -0.9018f; a[1] = -0.0010f; a[2] = -0.4099f; a[3] = 0.1370f;
|
||||
b[0] = -0.9104f; b[1] = -0.0010f; b[2] = -0.4138f;
|
||||
|
||||
BH_Quat4fIdentity(r);
|
||||
BH_VERIFY_DELTA(r[0], 0.000f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[1], 0.000f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[2], 0.000f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[3], 1.000f, ACCEPTABLE_DELTA);
|
||||
|
||||
BH_Quat4fConjugate(a, r);
|
||||
BH_VERIFY_DELTA(r[0], 0.9018f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[1], 0.0010f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[2], 0.4099f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[3], 0.1370f, ACCEPTABLE_DELTA);
|
||||
|
||||
BH_Quat4fToEuler(a, &roll, &pitch, &yaw);
|
||||
BH_VERIFY_DELTA(roll, -2.7671f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(pitch, -0.8324f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(yaw, -0.1649f, ACCEPTABLE_DELTA);
|
||||
|
||||
BH_Quat4fFromEuler(-2.7671f, -0.8324f, -0.1649f, r);
|
||||
BH_VERIFY_DELTA(r[0], -0.9018f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[1], -0.0010f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[2], -0.4099f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[3], 0.1370f, ACCEPTABLE_DELTA);
|
||||
|
||||
BH_Quat4fFromAxis(b, 2.8668f, r);
|
||||
BH_VERIFY_DELTA(r[0], -0.9018f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[1], -0.0010f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[2], -0.4099f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[3], 0.1370f, ACCEPTABLE_DELTA);
|
||||
|
||||
BH_Quat4fToAxis(a, r, &angle);
|
||||
BH_VERIFY_DELTA(r[0], -0.9104f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[1], -0.0010f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(r[2], -0.4138f, ACCEPTABLE_DELTA);
|
||||
BH_VERIFY_DELTA(angle, 2.8668f, ACCEPTABLE_DELTA);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
0
unit/CMakeLists.txt
Executable file → Normal file
0
unit/CMakeLists.txt
Executable file → Normal file
0
unit/include/BH/Unit.h
Executable file → Normal file
0
unit/include/BH/Unit.h
Executable file → Normal file
17
unit/src/Unit.c
Executable file → Normal file
17
unit/src/Unit.c
Executable file → Normal file
@@ -12,6 +12,21 @@ typedef struct BH_Unit
|
||||
static BH_Unit *root = NULL;
|
||||
|
||||
|
||||
static void BH_UnitCleanup(void)
|
||||
{
|
||||
BH_Unit *current;
|
||||
|
||||
current = root;
|
||||
while (current)
|
||||
{
|
||||
BH_Unit *next = current->next;
|
||||
|
||||
free(current);
|
||||
current = next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BH_UnitAdd(const char *name, BH_UnitCallback cb)
|
||||
{
|
||||
BH_Unit *unit, *current;
|
||||
@@ -49,6 +64,7 @@ int BH_UnitRun(void)
|
||||
if (current->cb())
|
||||
{
|
||||
printf("\tFAIL\n");
|
||||
BH_UnitCleanup();
|
||||
return -1;
|
||||
}
|
||||
printf("\tPASS\n");
|
||||
@@ -56,6 +72,7 @@ int BH_UnitRun(void)
|
||||
current = current->next;
|
||||
}
|
||||
|
||||
BH_UnitCleanup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user