Модульные тесты для арифметических операций с векторами и комплексными числами
This commit is contained in:
parent
2e902bc040
commit
f06b35ae34
14 changed files with 1317 additions and 0 deletions
|
|
@ -158,6 +158,7 @@
|
|||
<ClCompile Include="tests\complex\complex_reset.c" />
|
||||
<ClCompile Include="tests\complex\complex_set_values.c" />
|
||||
<ClCompile Include="tests\complex\complex_swap.c" />
|
||||
<ClCompile Include="tests\complex\complex_arithmetics.c" />
|
||||
<ClCompile Include="tests\quaternion.c" />
|
||||
<ClCompile Include="tests\quaternion\quaternion_copy.c" />
|
||||
<ClCompile Include="tests\quaternion\quaternion_is_unit.c" />
|
||||
|
|
@ -172,6 +173,7 @@
|
|||
<ClCompile Include="tests\utilities\is_unit.c" />
|
||||
<ClCompile Include="tests\utilities\is_zero.c" />
|
||||
<ClCompile Include="tests\vector2.c" />
|
||||
<ClCompile Include="tests\vector2\vector2_arithmetics.c" />
|
||||
<ClCompile Include="tests\vector2\vector2_is_unit.c" />
|
||||
<ClCompile Include="tests\vector2\vector2_is_zero.c" />
|
||||
<ClCompile Include="tests\vector2\vector2_copy.c" />
|
||||
|
|
@ -180,6 +182,7 @@
|
|||
<ClCompile Include="tests\vector2\vector2_set_values.c" />
|
||||
<ClCompile Include="tests\vector2\vector2_swap.c" />
|
||||
<ClCompile Include="tests\vector3.c" />
|
||||
<ClCompile Include="tests\vector3\vector3_arithmetics.c" />
|
||||
<ClCompile Include="tests\vector3\vector3_is_unit.c" />
|
||||
<ClCompile Include="tests\vector3\vector3_is_zero.c" />
|
||||
<ClCompile Include="tests\vector3\vector3_copy.c" />
|
||||
|
|
@ -206,6 +209,7 @@
|
|||
<ClInclude Include="tests\complex\complex_reset.h" />
|
||||
<ClInclude Include="tests\complex\complex_set_values.h" />
|
||||
<ClInclude Include="tests\complex\complex_swap.h" />
|
||||
<ClInclude Include="tests\complex\complex_arithmetics.h" />
|
||||
<ClInclude Include="tests\quaternion.h" />
|
||||
<ClInclude Include="tests\quaternion\quaternion_copy.h" />
|
||||
<ClInclude Include="tests\quaternion\quaternion_is_unit.h" />
|
||||
|
|
@ -220,6 +224,7 @@
|
|||
<ClInclude Include="tests\utilities\is_unit.h" />
|
||||
<ClInclude Include="tests\utilities\is_zero.h" />
|
||||
<ClInclude Include="tests\vector2.h" />
|
||||
<ClInclude Include="tests\vector2\vector2_arithmetics.h" />
|
||||
<ClInclude Include="tests\vector2\vector2_is_unit.h" />
|
||||
<ClInclude Include="tests\vector2\vector2_is_zero.h" />
|
||||
<ClInclude Include="tests\vector2\vector2_copy.h" />
|
||||
|
|
@ -228,6 +233,7 @@
|
|||
<ClInclude Include="tests\vector2\vector2_set_values.h" />
|
||||
<ClInclude Include="tests\vector2\vector2_swap.h" />
|
||||
<ClInclude Include="tests\vector3.h" />
|
||||
<ClInclude Include="tests\vector3\vector3_arithmetics.h" />
|
||||
<ClInclude Include="tests\vector3\vector3_is_unit.h" />
|
||||
<ClInclude Include="tests\vector3\vector3_is_zero.h" />
|
||||
<ClInclude Include="tests\vector3\vector3_copy.h" />
|
||||
|
|
|
|||
|
|
@ -138,6 +138,15 @@
|
|||
<ClCompile Include="tests\complex.c">
|
||||
<Filter>tests</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\vector2\vector2_arithmetics.c">
|
||||
<Filter>tests\vector2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\vector3\vector3_arithmetics.c">
|
||||
<Filter>tests\vector3</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\complex\complex_arithmetics.c">
|
||||
<Filter>tests\complex</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="helpers.h" />
|
||||
|
|
@ -276,6 +285,15 @@
|
|||
<ClInclude Include="tests\complex.h">
|
||||
<Filter>tests</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tests\vector2\vector2_arithmetics.h">
|
||||
<Filter>tests\vector2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tests\vector3\vector3_arithmetics.h">
|
||||
<Filter>tests\vector3</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tests\complex\complex_arithmetics.h">
|
||||
<Filter>tests\complex</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="tests">
|
||||
|
|
|
|||
|
|
@ -11,4 +11,9 @@ 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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "./complex/complex_is_zero.h"
|
||||
#include "./complex/complex_is_unit.h"
|
||||
#include "./complex/complex_modulus.h"
|
||||
#include "./complex/complex_arithmetics.h"
|
||||
|
||||
void test_complex();
|
||||
|
||||
|
|
|
|||
380
basic-geometry-test/tests/complex/complex_arithmetics.c
Normal file
380
basic-geometry-test/tests/complex/complex_arithmetics.c
Normal file
|
|
@ -0,0 +1,380 @@
|
|||
#include "./complex_arithmetics.h"
|
||||
#include "./../../helpers.h"
|
||||
|
||||
// ==================== Add ===================== //
|
||||
|
||||
void test_complex_add_fp32()
|
||||
{
|
||||
BgcComplexFP32 vector1, vector2, result;
|
||||
|
||||
print_testing_name("bgc_complex_add_fp32");
|
||||
|
||||
bgc_complex_set_values_fp32(10.0f, -20.0f, &vector1);
|
||||
bgc_complex_set_values_fp32(4.0f, 5.0f, &vector2);
|
||||
|
||||
bgc_complex_add_fp32(&vector1, &vector2, &result);
|
||||
|
||||