Skip to content
Snippets Groups Projects
Commit ded876b2 authored by arnaud.devevey's avatar arnaud.devevey
Browse files

pause midi

parent 284629ea
Branches
No related tags found
No related merge requests found
Pipeline #5918 failed
...@@ -25,7 +25,7 @@ vector.o : vector.c ...@@ -25,7 +25,7 @@ vector.o : vector.c
clean : clean :
rm -f *.o $(EXE) rm -f *.o galaxy
......
...@@ -5,17 +5,17 @@ ...@@ -5,17 +5,17 @@
* Date : xx.06.2019 * * Date : xx.06.2019 *
* * * * * * * * * * * * * * * */ * * * * * * * * * * * * * * * */
#include <stdio.h> // #include <stdio.h>
#include <stdlib.h> // #include <stdlib.h>
#include <string.h> // #include <string.h>
#include <math.h> // #include <math.h>
#include <stdint.h> #include <assert.h>
#include <time.h> // #include <stdint.h>
#include <libgen.h> // #include <time.h>
// #include <libgen.h>
#include "galaxy.h" #include "galaxy.h"
#include "quadtree.h" #include "quadtree.h"
...@@ -44,6 +44,12 @@ int main(int argc, char **argv) { ...@@ -44,6 +44,12 @@ int main(int argc, char **argv) {
destruction_galaxie(); destruction_galaxie();
*/ */
tests_vector();
// tests_star();
// tests_box();
// tests_quadtree();
// tests_galaxy();
// on crée une étoile en (0;0) qui a comme masse 10^6 * masse solaire // on crée une étoile en (0;0) qui a comme masse 10^6 * masse solaire
......
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <math.h> #include <math.h>
#include <assert.h>
#include "vector.h" #include "vector.h"
/* * * * * * * * * * * * * * * * *
* *
* --- TESTS --- *
* *
* * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * /* * * * * * * * * * * * * * * * *
* * * *
* --- FONCTIONS --- * * --- FONCTIONS --- *
...@@ -38,10 +52,11 @@ Vector* sub_vec(const Vector* const v1, const Vector* const v2) { ...@@ -38,10 +52,11 @@ Vector* sub_vec(const Vector* const v1, const Vector* const v2) {
return temp_vec; return temp_vec;
} }
/*
Vector* mul_vec(const Vector* const v1, const Vector* const v2) { Vector* mul_vec(const Vector* const v1, const Vector* const v2) {
} }
*/
Vector* scal_mul_vec(const Vector* const v1, const double lambda) { Vector* scal_mul_vec(const Vector* const v1, const double lambda) {
...@@ -55,7 +70,7 @@ Vector* scal_mul_vec(const Vector* const v1, const double lambda) { ...@@ -55,7 +70,7 @@ Vector* scal_mul_vec(const Vector* const v1, const double lambda) {
double norm(const Vector* const v1) { double norm(const Vector* const v1) {
return sqrt(pow(v1 -> x, 2.0) + pow(v1 -> x, 2.0)); return sqrt(pow(v1 -> x, 2.0) + pow(v1 -> y, 2.0));
} }
...@@ -73,3 +88,26 @@ double distance(const Vector* const v1, const Vector* const v2) { ...@@ -73,3 +88,26 @@ double distance(const Vector* const v1, const Vector* const v2) {
void print_vec(const Vector* const v) { void print_vec(const Vector* const v) {
printf("\tprint_vec() : x = %f \ty = %f \n", v -> x, v -> y); printf("\tprint_vec() : x = %f \ty = %f \n", v -> x, v -> y);
} }
void tests_vector() {
Vector* v1 = new_vec(1.0, 2.0);
Vector* v2 = new_vec(3.0, 5.0);
assert(v1 != NULL && v2 != NULL);
Vector* v_tests = new_vec(4.0, 7.0);
assert(add_vec(v1, v2) == v_tests);
v_tests -> x = -2.0;
v_tests -> y = -3.0;
assert(sub_vec(v1, v2) == v_tests);
assert(norm(v1) == sqrt(5));
v_tests -> x = 2.0;
v_tests -> y = 3.0;
double norm_tests = norm(v_tests);
assert(distance(v1, v2) == norm_tests);
}
\ No newline at end of file
...@@ -47,4 +47,7 @@ double distance(const Vector* const v1, const Vector* const v2); ...@@ -47,4 +47,7 @@ double distance(const Vector* const v1, const Vector* const v2);
void print_vec(const Vector* const v); void print_vec(const Vector* const v);
void tests_vector();
#endif #endif
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment