Using Unity (a special library for C for Unit tests)
This commit is contained in:
parent
857d79e572
commit
fd7c6c91cd
10 changed files with 4638 additions and 24 deletions
|
|
@ -49,6 +49,8 @@
|
|||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="main.h" />
|
||||
<Unit filename="test_utilities.h" />
|
||||
<Unit filename="tests/complex.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
|
|
@ -229,6 +231,11 @@
|
|||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="tests/versor/versor_swap.h" />
|
||||
<Unit filename="unity/unity.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="unity/unity.h" />
|
||||
<Unit filename="unity/unity_internals.h" />
|
||||
<Extensions />
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
||||
|
|
|
|||
|
|
@ -1,28 +1,19 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "helpers.h"
|
||||
#include "main.h"
|
||||
|
||||
#include "tests/utilities.h"
|
||||
#include "tests/vector2.h"
|
||||
#include "tests/vector3.h"
|
||||
#include "tests/complex.h"
|
||||
#include "tests/quaternion.h"
|
||||
#include "tests/versor.h"
|
||||
#include "unity/unity.h"
|
||||
|
||||
void setUp()
|
||||
{
|
||||
}
|
||||
|
||||
void tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test_utilities();
|
||||
|
||||
test_vector2();
|
||||
|
||||
test_vector3();
|
||||
|
||||
test_complex();
|
||||
|
||||
test_quaternion();
|
||||
|
||||
test_versor();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
8
basic-geometry-test/main.h
Normal file
8
basic-geometry-test/main.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef BGC_TEST_MAIN_H_INCLUDED
|
||||
#define BGC_TEST_MAIN_H_INCLUDED
|
||||
|
||||
void setUp();
|
||||
|
||||
void tearDown();
|
||||
|
||||
#endif
|
||||
8
basic-geometry-test/test_utilities.h
Normal file
8
basic-geometry-test/test_utilities.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef BGC_TEST_UTILITIES_H_INCLUDED
|
||||
#define BGC_TEST_UTILITIES_H_INCLUDED
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -11,9 +11,10 @@ void test_complex()
|
|||
test_complex_is_zero();
|
||||
test_complex_is_unit();
|
||||
test_complex_modulus();
|
||||
|
||||
/*
|
||||
test_complex_add();
|
||||
test_complex_subtract();
|
||||
test_complex_multiply();
|
||||
test_complex_divide();
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#include "vector2.h"
|
||||
#include "./vector2.h"
|
||||
|
||||
void test_vector2()
|
||||
{
|
||||
|
|
@ -11,11 +11,12 @@ void test_vector2()
|
|||
test_vector2_is_zero();
|
||||
test_vector2_is_unit();
|
||||
test_vector2_modulus();
|
||||
|
||||
/*
|
||||
test_vector2_add();
|
||||
test_vector2_subtract();
|
||||
test_vector2_multiply();
|
||||
test_vector2_divide();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#include "vector3.h"
|
||||
#include "./vector3.h"
|
||||
|
||||
#include "./../helpers.h"
|
||||
|
||||
void test_vector3()
|
||||
{
|
||||
|
|
@ -11,9 +13,10 @@ void test_vector3()
|
|||
test_vector3_is_zero();
|
||||
test_vector3_is_unit();
|
||||
test_vector3_modulus();
|
||||
|
||||
/*
|
||||
test_vector3_add();
|
||||
test_vector3_subtract();
|
||||