commit 9d173b9a9f1b1d20f47dccce5ee16f6d9c8c74b4
parent 44abc91bb19cf781fc996c7a3ea85de971147ff6
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 13 Dec 2017 11:03:28 +0100
Merge branch 'release_0.2.1'
Diffstat:
8 files changed, 697 insertions(+), 692 deletions(-)
diff --git a/README.md b/README.md
@@ -1,7 +1,7 @@
# Solstice Animation
-The purpose of this library is to compute the positioning of the constituents
-of a solar facility. It has been developed in the scope of the Solstice project,
+The purpose of this library is to compute the positioning of the constituents
+of a solar facility. It has been developed in the scope of the Solstice project,
in collaboration with the
[Laboratory of Excellence Solstice](http://www.labex-solstice.fr) and the
[PROMES](http://www.promes.cnrs.fr/index.php?page=home-en) laboratory of the
@@ -23,6 +23,11 @@ variable the install directories of its dependencies.
## Release notes
+### Version 0.2.1
+
+- Update the version of the RSys dependency to 0.6: replace the deprecated
+ `[N]CHECK` macros by the new macro `CHK`.
+
### Version 0.2
- Update the `sanim_node_visit_tree` function: the submitted sun direction may
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -24,7 +24,7 @@ option(NO_TEST "Do not build tests" OFF)
# Check dependencies
################################################################################
find_package(RCMake 0.2.3 REQUIRED)
-find_package(RSys 0.3 REQUIRED)
+find_package(RSys 0.6 REQUIRED)
find_package(OpenMP 1.2 REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${RCMAKE_SOURCE_DIR})
@@ -41,7 +41,7 @@ rcmake_append_runtime_dirs(_runtime_dirs RSys)
################################################################################
set(VERSION_MAJOR 0)
set(VERSION_MINOR 2)
-set(VERSION_PATCH 0)
+set(VERSION_PATCH 1)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
set(SANIM_FILES_SRC
diff --git a/src/test_sanim_node.c b/src/test_sanim_node.c
@@ -38,135 +38,135 @@ main(int argc, char** argv)
mem_init_proxy_allocator(&allocator, &mem_default_allocator);
- CHECK(my_type_create(NULL, &t1), RES_OK);
- CHECK(my_type_ref_put(NULL), RES_BAD_ARG);
- CHECK(my_type_ref_get(NULL), RES_BAD_ARG);
- CHECK(my_type_ref_get(t1), RES_OK);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_create(&allocator, NULL), RES_BAD_ARG);
- CHECK(my_type_create(&allocator, &t2), RES_OK);
- CHECK(my_type_ref_put(t1), RES_OK);
-
- CHECK(my_type_pivot_create(&allocator, NULL, &tracking, &t1), RES_BAD_ARG);
- CHECK(my_type_pivot_create(&allocator, &pivot, NULL, &t1), RES_BAD_ARG);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, NULL), RES_BAD_ARG);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t1), RES_OK);
-
- CHECK(my_type_is_pivot(NULL, &p), RES_BAD_ARG);
- CHECK(my_type_is_pivot(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_is_pivot(t1, &p), RES_OK);
- CHECK(p, 1);
- CHECK(my_type_ref_put(t1), RES_OK);
-
- CHECK(my_type_create(&allocator, &t1), RES_OK);
-
- CHECK(my_type_is_pivot(t1, &p), RES_OK);
- CHECK(p, 0);
-
- CHECK(my_type_add_child(NULL, t1), RES_BAD_ARG);
- CHECK(my_type_add_child(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_add_child(t1, t1), RES_BAD_ARG);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_BAD_ARG);
- CHECK(my_type_add_child(t2, t1), RES_BAD_ARG);
-
- CHECK(my_type_copy_create(NULL, &ptr), RES_BAD_ARG);
- CHECK(my_type_copy_create(t1, NULL), RES_BAD_ARG);
-
- CHECK(my_type_get_father(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_get_father(NULL, &ptr), RES_BAD_ARG);
- CHECK(my_type_get_children_count(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_get_children_count(NULL, &count), RES_BAD_ARG);
- CHECK(my_type_get_children_count(t1, &count), RES_OK);
- CHECK(count, 1);
- CHECK(my_type_get_child(NULL, 0, &ptr), RES_BAD_ARG);
- CHECK(my_type_get_child(t1, 10, &ptr), RES_BAD_ARG);
- CHECK(my_type_get_child(t1, 0, NULL), RES_BAD_ARG);
- CHECK(my_type_get_child(t1, 0, &ptr), RES_OK);
- CHECK(ptr, t2);
- CHECK(my_type_get_father(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_get_father(NULL, &ptr), RES_BAD_ARG);
- CHECK(my_type_get_father(t1, &ptr), RES_OK);
- CHECK(ptr, NULL);
- CHECK(my_type_get_father(t2, &ptr), RES_OK);
- CHECK(ptr, t1);
-
- CHECK(my_type_set_translation(NULL, transl), RES_BAD_ARG);
- CHECK(my_type_set_translation(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
-
- CHECK(my_type_get_translation(NULL, transl_), RES_BAD_ARG);
- CHECK(my_type_get_translation(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_get_translation(t1, transl_), RES_OK);
- CHECK(d3_eq(transl, transl_), 1);
-
- CHECK(my_type_set_rotations(NULL, rot), RES_BAD_ARG);
- CHECK(my_type_set_rotations(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
-
- CHECK(my_type_get_rotations(NULL, rot_), RES_BAD_ARG);
- CHECK(my_type_get_rotations(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_get_rotations(t1, rot_), RES_OK);
- CHECK(d3_eq(rot, rot_), 1);
-
- CHECK(my_type_get_transform(NULL, transform1), RES_BAD_ARG);
- CHECK(my_type_get_transform(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_get_transform(t1, transform1), RES_OK);
-
- CHECK(my_type_copy_create(NULL, &ptr), RES_BAD_ARG);
- CHECK(my_type_copy_create(t1, NULL), RES_BAD_ARG);
+ CHK(my_type_create(NULL, &t1) == RES_OK);
+ CHK(my_type_ref_put(NULL) == RES_BAD_ARG);
+ CHK(my_type_ref_get(NULL) == RES_BAD_ARG);
+ CHK(my_type_ref_get(t1) == RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_create(&allocator, NULL) == RES_BAD_ARG);
+ CHK(my_type_create(&allocator, &t2) == RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+
+ CHK(my_type_pivot_create(&allocator, NULL, &tracking, &t1) == RES_BAD_ARG);
+ CHK(my_type_pivot_create(&allocator, &pivot, NULL, &t1) == RES_BAD_ARG);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, NULL) == RES_BAD_ARG);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t1) == RES_OK);
+
+ CHK(my_type_is_pivot(NULL, &p) == RES_BAD_ARG);
+ CHK(my_type_is_pivot(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_is_pivot(t1, &p) == RES_OK);
+ CHK(p == 1);
+ CHK(my_type_ref_put(t1) == RES_OK);
+
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+
+ CHK(my_type_is_pivot(t1, &p) == RES_OK);
+ CHK(p == 0);
+
+ CHK(my_type_add_child(NULL, t1) == RES_BAD_ARG);
+ CHK(my_type_add_child(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_add_child(t1, t1) == RES_BAD_ARG);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_BAD_ARG);
+ CHK(my_type_add_child(t2, t1) == RES_BAD_ARG);
+
+ CHK(my_type_copy_create(NULL, &ptr) == RES_BAD_ARG);
+ CHK(my_type_copy_create(t1, NULL) == RES_BAD_ARG);
+
+ CHK(my_type_get_father(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_get_father(NULL, &ptr) == RES_BAD_ARG);
+ CHK(my_type_get_children_count(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_get_children_count(NULL, &count) == RES_BAD_ARG);
+ CHK(my_type_get_children_count(t1, &count) == RES_OK);
+ CHK(count == 1);
+ CHK(my_type_get_child(NULL, 0, &ptr) == RES_BAD_ARG);
+ CHK(my_type_get_child(t1, 10, &ptr) == RES_BAD_ARG);
+ CHK(my_type_get_child(t1, 0, NULL) == RES_BAD_ARG);
+ CHK(my_type_get_child(t1, 0, &ptr) == RES_OK);
+ CHK(ptr == t2);
+ CHK(my_type_get_father(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_get_father(NULL, &ptr) == RES_BAD_ARG);
+ CHK(my_type_get_father(t1, &ptr) == RES_OK);
+ CHK(ptr == NULL);
+ CHK(my_type_get_father(t2, &ptr) == RES_OK);
+ CHK(ptr == t1);
+
+ CHK(my_type_set_translation(NULL, transl) == RES_BAD_ARG);
+ CHK(my_type_set_translation(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+
+ CHK(my_type_get_translation(NULL, transl_) == RES_BAD_ARG);
+ CHK(my_type_get_translation(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_get_translation(t1, transl_) == RES_OK);
+ CHK(d3_eq(transl, transl_) == 1);
+
+ CHK(my_type_set_rotations(NULL, rot) == RES_BAD_ARG);
+ CHK(my_type_set_rotations(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+
+ CHK(my_type_get_rotations(NULL, rot_) == RES_BAD_ARG);
+ CHK(my_type_get_rotations(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_get_rotations(t1, rot_) == RES_OK);
+ CHK(d3_eq(rot, rot_) == 1);
+
+ CHK(my_type_get_transform(NULL, transform1) == RES_BAD_ARG);
+ CHK(my_type_get_transform(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_get_transform(t1, transform1) == RES_OK);
+
+ CHK(my_type_copy_create(NULL, &ptr) == RES_BAD_ARG);
+ CHK(my_type_copy_create(t1, NULL) == RES_BAD_ARG);
/*t1->my_data = 1;*/
- CHECK(my_type_copy_create(t1, &ptr), RES_OK);
- CHECK(t1->my_data, ptr->my_data);
- CHECK(my_type_get_transform(ptr, transform2), RES_OK);
- CHECK(d34_eq_eps(transform1, transform2, 0), 1);
- CHECK(my_type_ref_put(ptr), RES_OK);
+ CHK(my_type_copy_create(t1, &ptr) == RES_OK);
+ CHK(t1->my_data == ptr->my_data);
+ CHK(my_type_get_transform(ptr, transform2) == RES_OK);
+ CHK(d34_eq_eps(transform1, transform2, 0) == 1);
+ CHK(my_type_ref_put(ptr) == RES_OK);
- CHECK(my_type_recursive_copy(&allocator, NULL, &ptr), RES_BAD_ARG);
- CHECK(my_type_recursive_copy(&allocator, t1, NULL), RES_BAD_ARG);
- CHECK(my_type_recursive_copy(&allocator, t1, &t1), RES_BAD_ARG);
- CHECK(my_type_recursive_copy(&allocator, t1, &ptr), RES_OK);
+ CHK(my_type_recursive_copy(&allocator, NULL, &ptr) == RES_BAD_ARG);
+ CHK(my_type_recursive_copy(&allocator, t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_recursive_copy(&allocator, t1, &t1) == RES_BAD_ARG);
+ CHK(my_type_recursive_copy(&allocator, t1, &ptr) == RES_OK);
tracking.policy = TRACKING_POINT;
tracking.data.node_target.tracked_node = NULL;
- CHECK(my_type_track_me(NULL, &tracking), RES_BAD_ARG);
- CHECK(my_type_track_me(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_track_me(t1, &tracking), RES_OK);
- CHECK(tracking.policy, TRACKING_NODE_TARGET);
- CHECK(&t1->node, tracking.data.node_target.tracked_node);
+ CHK(my_type_track_me(NULL, &tracking) == RES_BAD_ARG);
+ CHK(my_type_track_me(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_track_me(t1, &tracking) == RES_OK);
+ CHK(tracking.policy == TRACKING_NODE_TARGET);
+ CHK(&t1->node == tracking.data.node_target.tracked_node);
/* Some sanim API tests that cannot be carried out through my_type testing.
* Test use of non-initialized sanim nodes. */
- CHECK(sanim_node_is_initialized(NULL, &p), RES_BAD_ARG);
- CHECK(sanim_node_is_initialized(&s1, NULL), RES_BAD_ARG);
- CHECK(sanim_node_is_initialized(&s1, &p), RES_OK);
- CHECK(p, 0);
- CHECK(sanim_node_release(&s1), RES_OK); /* safe release of uninitialized nodes */
- CHECK(sanim_node_initialize(&allocator, NULL), RES_BAD_ARG);
- CHECK(sanim_node_initialize(&allocator, &s1), RES_OK);
- CHECK(sanim_node_is_initialized(&s1, &p), RES_OK);
- CHECK(p, 1);
- CHECK(sanim_node_release(&s1), RES_OK);
- CHECK(sanim_node_is_initialized(&s2, &p), RES_OK);
- CHECK(p, 0);
- CHECK(sanim_node_initialize_pivot(&allocator, NULL, &tracking, &s2), RES_BAD_ARG);
- CHECK(sanim_node_initialize_pivot(&allocator, &pivot, NULL, &s2), RES_BAD_ARG);
- CHECK(sanim_node_initialize_pivot(&allocator, &pivot, &tracking, NULL), RES_BAD_ARG);
- CHECK(sanim_node_initialize_pivot(&allocator, &pivot, &tracking, &s2), RES_OK);
- CHECK(sanim_node_is_initialized(&s2, &p), RES_OK);
- CHECK(p, 1);
- CHECK(sanim_node_release(NULL), RES_BAD_ARG);
- CHECK(sanim_node_release(&s2), RES_OK);
- CHECK(sanim_node_release(&s2), RES_OK); /* safe mumtiple release */
+ CHK(sanim_node_is_initialized(NULL, &p) == RES_BAD_ARG);
+ CHK(sanim_node_is_initialized(&s1, NULL) == RES_BAD_ARG);
+ CHK(sanim_node_is_initialized(&s1, &p) == RES_OK);
+ CHK(p == 0);
+ CHK(sanim_node_release(&s1) == RES_OK); /* safe release of uninitialized nodes */
+ CHK(sanim_node_initialize(&allocator, NULL) == RES_BAD_ARG);
+ CHK(sanim_node_initialize(&allocator, &s1) == RES_OK);
+ CHK(sanim_node_is_initialized(&s1, &p) == RES_OK);
+ CHK(p == 1);
+ CHK(sanim_node_release(&s1) == RES_OK);
+ CHK(sanim_node_is_initialized(&s2, &p) == RES_OK);
+ CHK(p == 0);
+ CHK(sanim_node_initialize_pivot(&allocator, NULL, &tracking, &s2) == RES_BAD_ARG);
+ CHK(sanim_node_initialize_pivot(&allocator, &pivot, NULL, &s2) == RES_BAD_ARG);
+ CHK(sanim_node_initialize_pivot(&allocator, &pivot, &tracking, NULL) == RES_BAD_ARG);
+ CHK(sanim_node_initialize_pivot(&allocator, &pivot, &tracking, &s2) == RES_OK);
+ CHK(sanim_node_is_initialized(&s2, &p) == RES_OK);
+ CHK(p == 1);
+ CHK(sanim_node_release(NULL) == RES_BAD_ARG);
+ CHK(sanim_node_release(&s2) == RES_OK);
+ CHK(sanim_node_release(&s2) == RES_OK); /* safe mumtiple release */
/* release memory */
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(ptr), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(ptr) == RES_OK);
check_memory_allocator(&allocator);
mem_shutdown_proxy_allocator(&allocator);
- CHECK(mem_allocated_size(), 0);
+ CHK(mem_allocated_size() == 0);
return 0;
}
diff --git a/src/test_sanim_node_pivot.c b/src/test_sanim_node_pivot.c
@@ -45,41 +45,41 @@ main(int argc, char** argv)
/* ref_normal not in the YZ plane */
d3(pivot.data.pivot1.ref_normal, 1, 0, 1);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t1), RES_BAD_ARG);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t1) == RES_BAD_ARG);
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t1), RES_OK);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_pivot_create(NULL, &pivot, &tracking, &t1), RES_OK);
- CHECK(my_type_ref_put(t1), RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t1) == RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_pivot_create(NULL, &pivot, &tracking, &t1) == RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
d3_splat(transl, +1);
d3(rot, 0, 0, PI/2);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0.99, -0.1);
/* rotation axis is Y after positioning: cannot accomodate in_dir */
- CHECK(my_type_solve_pivot(t2, in_dir), RES_BAD_ARG);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_BAD_ARG);
d3(in_dir, 1, 0.2, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, pivot.data.pivot1.ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, -sqrt(2), 3, 2), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, -sqrt(2), 3, 2), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 1 axis tracking with a fixed output dir */
@@ -88,53 +88,53 @@ main(int argc, char** argv)
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
d3(tracking.data.out_dir.u, 0, 1, 0);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, -1, -0.1);
/* rotation axis is Y after positioning: cannot accomodate <in_dir,out_dir> */
- CHECK(my_type_solve_pivot(t2, in_dir), RES_BAD_ARG);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_BAD_ARG);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_OUT_DIR;
pivot.type = PIVOT_SINGLE_AXIS;
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
d3(tracking.data.out_dir.u, 1, 0, 1);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, -0.3, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, pivot.data.pivot1.ref_normal);
- CHECK(d3_eq_eps(pivot.data.pivot1.ref_normal, n, 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(n, -1, 3, 3), 1e-7), 1);
+ CHK(d3_eq_eps(pivot.data.pivot1.ref_normal, n, 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(n, -1, 3, 3), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 1 axis tracking a target point */
@@ -145,27 +145,27 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 0, 0, 30);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0.1, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, pivot.data.pivot1.ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_SINGLE_AXIS;
@@ -174,27 +174,27 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 0, 10, 30);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0.1, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, pivot.data.pivot1.ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* same 1 axis tracking with a non-local target point */
@@ -205,27 +205,27 @@ main(int argc, char** argv)
d3(tracking.data.point.target, -10, 2, 32);
tracking.data.point.target_is_local = 0;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, -0.5, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, pivot.data.pivot1.ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_SINGLE_AXIS;
@@ -234,86 +234,86 @@ main(int argc, char** argv)
d3(tracking.data.point.target, -12, 2, -10);
tracking.data.point.target_is_local = 0;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, pivot.data.pivot1.ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -1, 0, 0), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, -1, 3, 1), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -1, 0, 0), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, -1, 3, 1), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 1 axis tracking an invalid node target */
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
d3(pivot.data.pivot1.ref_point, 0, 0, 0);
- CHECK(my_type_track_me(t3, &tracking), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
+ CHK(my_type_track_me(t3, &tracking) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0.1, 0);
/* target if after a pivot */
- CHECK(my_type_solve_pivot(t2, in_dir), RES_BAD_ARG);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_BAD_ARG);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 1 axis tracking a node target */
- CHECK(my_type_create(&allocator, &target), RES_OK);
+ CHK(my_type_create(&allocator, &target) == RES_OK);
d3(tmp, 0, 0, 10 * sqrt(2));
- CHECK(my_type_set_translation(target, tmp), RES_OK);
+ CHK(my_type_set_translation(target, tmp) == RES_OK);
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
d3(pivot.data.pivot1.ref_point, 0, 0, 0);
- CHECK(my_type_track_me(target, &tracking), RES_OK);
+ CHK(my_type_track_me(target, &tracking) == RES_OK);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0.1, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, pivot.data.pivot1.ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
- CHECK(my_type_ref_put(target), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
+ CHK(my_type_ref_put(target) == RES_OK);
/*
* 2 axis pivots
@@ -327,37 +327,37 @@ main(int argc, char** argv)
pivot.data.pivot2.spacing = 1;
d3(pivot.data.pivot2.ref_point, 0, 0, 1);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
d3_splat(transl, +1);
d3(rot, 0, 0, PI / 2);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, -1, 3, 2 + sqrt(2)), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, -1, 3, 2 + sqrt(2)), 1e-7) == 1);
d3(in_dir, 0, 1, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, 0, -1, 0), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, -1, 0, 3), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, 0, -1, 0), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, -1, 0, 3), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 2 axis tracking sun */
@@ -365,37 +365,37 @@ main(int argc, char** argv)
pivot.type = PIVOT_TWO_AXIS;
pivot.data.pivot2.spacing = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
d3_splat(transl, +1);
d3(rot, 0, 0, PI / 2);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, -1, 3, 2 + sqrt(2)), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, -1, 3, 2 + sqrt(2)), 1e-7) == 1);
d3(in_dir, 0, 1, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, 0, -1, 0), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, -1, 0, 3), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, 0, -1, 0), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, -1, 0, 3), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 2 axis tracking with a fixed output dir */
@@ -404,35 +404,35 @@ main(int argc, char** argv)
pivot.data.pivot2.spacing = 1;
d3(tracking.data.out_dir.u, 0, 1, 0);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, 0, sqrt(2) / 2, sqrt(2) / 2), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, 1, 3, 2 + sqrt(2)), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, 0, sqrt(2) / 2, sqrt(2) / 2), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, 1, 3, 2 + sqrt(2)), 1e-7) == 1);
d3(in_dir, -1, 0, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, sqrt(2) / 2, sqrt(2) / 2, 0), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, 3 * sqrt(2) / 2, 2 + sqrt(2) / 2, 3), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, sqrt(2) / 2, sqrt(2) / 2, 0), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, 3 * sqrt(2) / 2, 2 + sqrt(2) / 2, 3), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 2 axis tracking a target point */
@@ -443,28 +443,28 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 30, 0, 0);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, -1, 0, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, sqrt(2) / 2, sqrt(2) / 2, 0), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, sqrt(2), 2, 3), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, sqrt(2) / 2, sqrt(2) / 2, 0), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, sqrt(2), 2, 3), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_TWO_AXIS;
@@ -473,28 +473,28 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 30, -11, 0);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, -1, 0, 0);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, sqrt(2) / 2, sqrt(2) / 2, 0), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, 1 + sqrt(2), 3, 3), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, sqrt(2) / 2, sqrt(2) / 2, 0), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, 1 + sqrt(2), 3, 3), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_TWO_AXIS;
@@ -503,28 +503,28 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 0, 30, 10);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, -1, 3, 2 + sqrt(2)), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, -sqrt(2) / 2, 0, +sqrt(2) / 2), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, -1, 3, 2 + sqrt(2)), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_TWO_AXIS;
@@ -533,28 +533,28 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 0, 30, 12);
tracking.data.point.target_is_local = 0;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, 0, sqrt(2) / 2, sqrt(2) / 2), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, 1, 3, 2 + sqrt(2)), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, 0, sqrt(2) / 2, sqrt(2) / 2), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, 1, 3, 2 + sqrt(2)), 1e-7) == 1);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_TWO_AXIS;
@@ -563,31 +563,31 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 10, 12, 15);
tracking.data.point.target_is_local = 0;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0, -1);
- CHECK(my_type_solve_pivot(t2, in_dir), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
+ CHK(my_type_solve_pivot(t2, in_dir) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
d33_muld3(n, transform, y_ref_normal);
- CHECK(d3_eq_eps(n, d3(tmp, 0, sqrt(2) / 2, sqrt(2) / 2), 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, d3(tmp, 1, 3, 2 + sqrt(2)), 1e-7), 1);
+ CHK(d3_eq_eps(n, d3(tmp, 0, sqrt(2) / 2, sqrt(2) / 2), 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, d3(tmp, 1, 3, 2 + sqrt(2)), 1e-7) == 1);
/* release memory */
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
check_memory_allocator(&allocator);
mem_shutdown_proxy_allocator(&allocator);
- CHECK(mem_allocated_size(), 0);
+ CHK(mem_allocated_size() == 0);
return 0;
}
diff --git a/src/test_sanim_node_transform.c b/src/test_sanim_node_transform.c
@@ -30,112 +30,112 @@ main(int argc, char** argv)
mem_init_proxy_allocator(&allocator, &mem_default_allocator);
/* test a typical use in my_type */
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_create(&allocator, &t2), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_create(&allocator, &t2) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
d3_splat(transl, +1);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
d3_splat(transl, -1);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
- CHECK(my_type_get_transform(t2, transform), RES_OK);
- CHECK(d33_is_identity(transform), 1);
- CHECK(d3_is_zero(transform + 9), 1);
+ CHK(my_type_get_transform(t2, transform) == RES_OK);
+ CHK(d33_is_identity(transform) == 1);
+ CHK(d3_is_zero(transform + 9) == 1);
d3(rot, PI, 0, 0);
- CHECK(my_type_set_rotations(NULL, rot), RES_BAD_ARG);
- CHECK(my_type_set_rotations(t1, NULL), RES_BAD_ARG);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_rotations(t2, rot), RES_OK);
+ CHK(my_type_set_rotations(NULL, rot) == RES_BAD_ARG);
+ CHK(my_type_set_rotations(t1, NULL) == RES_BAD_ARG);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_rotations(t2, rot) == RES_OK);
d3(transl, 0, +1, 0);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
- CHECK(my_type_get_transform(t2, transform), RES_OK);
- CHECK(d33_is_identity_eps(transform, 1e-7), 1);
- CHECK(d3_is_zero_eps(transform + 9, 1e-7), 1);
+ CHK(my_type_get_transform(t2, transform) == RES_OK);
+ CHK(d33_is_identity_eps(transform, 1e-7) == 1);
+ CHK(d3_is_zero_eps(transform + 9, 1e-7) == 1);
/* check translation & 1 rotation in a single node VS in 2 chained nodes */
d3(rot, 0.17, 0, 0);
d3(transl, 0.3, 2, -1);
- CHECK(my_type_create(&allocator, &t), RES_OK);
- CHECK(my_type_set_translation(t, transl), RES_OK);
- CHECK(my_type_set_rotations(t, rot), RES_OK);
- CHECK(my_type_get_transform(t, transform), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_create(&allocator, &t) == RES_OK);
+ CHK(my_type_set_translation(t, transl) == RES_OK);
+ CHK(my_type_set_rotations(t, rot) == RES_OK);
+ CHK(my_type_get_transform(t, transform) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
d3(rot, 0, 0, 0);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
d3(transl, 0, 0, 0);
d3(rot, 0.17, 0, 0);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_rotations(t2, rot), RES_OK);
- CHECK(my_type_get_transform(t2, transform_), RES_OK);
- CHECK(d33_eq_eps(transform, transform_, 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, transform_ + 9, 1e-7), 1);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_rotations(t2, rot) == RES_OK);
+ CHK(my_type_get_transform(t2, transform_) == RES_OK);
+ CHK(d33_eq_eps(transform, transform_, 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, transform_ + 9, 1e-7) == 1);
/* check translation & 2 rotations in a single node VS in 2 chained nodes */
d3(rot, 0.17, -0.52, 0);
d3(transl, 0.3, 2, -1);
- CHECK(my_type_set_translation(t, transl), RES_OK);
- CHECK(my_type_set_rotations(t, rot), RES_OK);
- CHECK(my_type_get_transform(t, transform), RES_OK);
+ CHK(my_type_set_translation(t, transl) == RES_OK);
+ CHK(my_type_set_rotations(t, rot) == RES_OK);
+ CHK(my_type_get_transform(t, transform) == RES_OK);
d3(rot, 0, 0, 0);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
d3(transl, 0, 0, 0);
d3(rot, 0.17, 0, 0);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_rotations(t2, rot), RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_rotations(t2, rot) == RES_OK);
d3(rot, 0, -0.52, 0);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
- CHECK(my_type_set_rotations(t3, rot), RES_OK);
- CHECK(my_type_get_transform(t3, transform_), RES_OK);
- CHECK(d33_eq_eps(transform, transform_, 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, transform_ + 9, 1e-7), 1);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
+ CHK(my_type_set_rotations(t3, rot) == RES_OK);
+ CHK(my_type_get_transform(t3, transform_) == RES_OK);
+ CHK(d33_eq_eps(transform, transform_, 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, transform_ + 9, 1e-7) == 1);
/* check 1 node with 3 rotations VS 3 chained nodes with 1 rotation each */
d3(rot, 0.17, -0.52, 0.31);
d3(transl, 0.3, 2, -1);
- CHECK(my_type_set_translation(t, transl), RES_OK);
- CHECK(my_type_set_rotations(t, rot), RES_OK);
- CHECK(my_type_get_transform(t, transform), RES_OK);
+ CHK(my_type_set_translation(t, transl) == RES_OK);
+ CHK(my_type_set_rotations(t, rot) == RES_OK);
+ CHK(my_type_get_transform(t, transform) == RES_OK);
d3(rot, 0.17, 0, 0);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
d3(transl, 0, 0, 0);
d3(rot, 0, -0.52, 0);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_rotations(t2, rot), RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_rotations(t2, rot) == RES_OK);
d3(rot, 0, 0, 0.31);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
- CHECK(my_type_set_rotations(t3, rot), RES_OK);
- CHECK(my_type_get_transform(t3, transform_), RES_OK);
- CHECK(d33_eq_eps(transform, transform_, 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, transform_ + 9, 1e-7), 1);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
+ CHK(my_type_set_rotations(t3, rot) == RES_OK);
+ CHK(my_type_get_transform(t3, transform_) == RES_OK);
+ CHK(d33_eq_eps(transform, transform_, 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, transform_ + 9, 1e-7) == 1);
/* check 3 chained nodes with 1 rotation each VS a copy */
- CHECK(my_type_ref_put(t), RES_OK);
- CHECK(my_type_recursive_copy(&allocator, t1, &t), RES_OK);
- CHECK(my_type_get_transform(t3, transform), RES_OK);
- CHECK(my_type_get_child(t, 0, &ptr), RES_OK);
- CHECK(my_type_get_child(ptr, 0, &ptr), RES_OK);
- CHECK(my_type_get_transform(ptr, transform_), RES_OK);
- CHECK(d33_eq_eps(transform, transform_, 1e-7), 1);
- CHECK(d3_eq_eps(transform + 9, transform_ + 9, 1e-7), 1);
+ CHK(my_type_ref_put(t) == RES_OK);
+ CHK(my_type_recursive_copy(&allocator, t1, &t) == RES_OK);
+ CHK(my_type_get_transform(t3, transform) == RES_OK);
+ CHK(my_type_get_child(t, 0, &ptr) == RES_OK);
+ CHK(my_type_get_child(ptr, 0, &ptr) == RES_OK);
+ CHK(my_type_get_transform(ptr, transform_) == RES_OK);
+ CHK(d33_eq_eps(transform, transform_, 1e-7) == 1);
+ CHK(d3_eq_eps(transform + 9, transform_ + 9, 1e-7) == 1);
/* release memory */
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
- CHECK(my_type_ref_put(t), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
+ CHK(my_type_ref_put(t) == RES_OK);
check_memory_allocator(&allocator);
mem_shutdown_proxy_allocator(&allocator);
- CHECK(mem_allocated_size(), 0);
+ CHK(mem_allocated_size() == 0);
return 0;
}
diff --git a/src/test_sanim_search.c b/src/test_sanim_search.c
@@ -58,32 +58,32 @@ main(int argc, char** argv)
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
/* ref_normal not in the YZ plane */
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
data.result = NULL;
- CHECK(sanim_node_search_tree(NULL, &data, search, &found), RES_BAD_ARG);
- CHECK(sanim_node_search_tree(&t1->node, NULL, search, &found), RES_BAD_ARG);
- CHECK(sanim_node_search_tree(&t1->node, &data, NULL, &found), RES_BAD_ARG);
- CHECK(sanim_node_search_tree(&t1->node, &data, search, NULL), RES_BAD_ARG);
- CHECK(sanim_node_search_tree(&t1->node, &data, search, &found), RES_OK);
- CHECK(data.result, t2);
+ CHK(sanim_node_search_tree(NULL, &data, search, &found) == RES_BAD_ARG);
+ CHK(sanim_node_search_tree(&t1->node, NULL, search, &found) == RES_BAD_ARG);
+ CHK(sanim_node_search_tree(&t1->node, &data, NULL, &found) == RES_BAD_ARG);
+ CHK(sanim_node_search_tree(&t1->node, &data, search, NULL) == RES_BAD_ARG);
+ CHK(sanim_node_search_tree(&t1->node, &data, search, &found) == RES_OK);
+ CHK(data.result == t2);
data.result = NULL;
- CHECK(sanim_node_search_tree(&t3->node, &data, search, &found), RES_OK);
- CHECK(data.result, NULL);
+ CHK(sanim_node_search_tree(&t3->node, &data, search, &found) == RES_OK);
+ CHK(data.result == NULL);
/* release memory */
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
check_memory_allocator(&allocator);
mem_shutdown_proxy_allocator(&allocator);
- CHECK(mem_allocated_size(), 0);
+ CHK(mem_allocated_size() == 0);
return 0;
}
diff --git a/src/test_sanim_utils.c b/src/test_sanim_utils.c
@@ -178,11 +178,11 @@ my_type_recursive_copy_
if (res != RES_OK) goto error;
darray_tmp_push_back(tmp, &root);
if (res != RES_OK) goto error;
- CHECK(my_type_get_children_count(src, &sz), RES_OK);
+ CHK(my_type_get_children_count(src, &sz) == RES_OK);
for (i = 0; i < sz; i++) {
struct my_type* child;
struct my_type* node;
- CHECK(my_type_get_child(src, i, &child), RES_OK);
+ CHK(my_type_get_child(src, i, &child) == RES_OK);
res = my_type_recursive_copy_(alloc, child, tmp, &node);
if (res != RES_OK) goto error;
my_type_add_child(root, node);
@@ -236,10 +236,10 @@ my_type_release(ref_T* ref)
size_t i, sz;
struct my_type* t = CONTAINER_OF(ref, struct my_type, ref);
if (t->node.data) {
- CHECK(my_type_get_children_count(t, &sz), RES_OK);
+ CHK(my_type_get_children_count(t, &sz) == RES_OK);
for (i = 0; i < sz; i++) {
struct my_type* node;
- CHECK(my_type_get_child(t, i, &node), RES_OK);
+ CHK(my_type_get_child(t, i, &node) == RES_OK);
my_type_ref_put(node);
}
}
diff --git a/src/test_sanim_visit.c b/src/test_sanim_visit.c
@@ -48,27 +48,27 @@ check_visit
double transform[12];
htable_transforms_init(&allocator, &transforms);
- CHECK(sanim_node_visit_tree(
- &root->node, in_dir, &transforms, store_transform), RES_OK);
- CHECK(htable_transforms_size_get(&transforms), 3);
+ CHK(sanim_node_visit_tree(
+ &root->node, in_dir, &transforms, store_transform) == RES_OK);
+ CHK(htable_transforms_size_get(&transforms) == 3);
key = &leaf->node;
tr = htable_transforms_find(&transforms, &key);
- NCHECK(tr, NULL);
- CHECK(my_type_solve_pivot(pivot, in_dir), RES_OK);
- CHECK(my_type_get_transform(leaf, transform), RES_OK);
+ CHK(tr != NULL);
+ CHK(my_type_solve_pivot(pivot, in_dir) == RES_OK);
+ CHK(my_type_get_transform(leaf, transform) == RES_OK);
key = &leaf->node;
tr = htable_transforms_find(&transforms, &key);
- NCHECK(tr, NULL);
+ CHK(tr != NULL);
d34_eq_eps(tr->transform, transform, 1e-10);
- CHECK(my_type_get_transform(pivot, transform), RES_OK);
+ CHK(my_type_get_transform(pivot, transform) == RES_OK);
key = &pivot->node;
tr = htable_transforms_find(&transforms, &key);
- NCHECK(tr, NULL);
+ CHK(tr != NULL);
d34_eq_eps(tr->transform, transform, 1e-10);
- CHECK(my_type_get_transform(root, transform), RES_OK);
+ CHK(my_type_get_transform(root, transform) == RES_OK);
key = &root->node;
tr = htable_transforms_find(&transforms, &key);
- NCHECK(tr, NULL);
+ CHK(tr != NULL);
d34_eq_eps(tr->transform, transform, 1e-10);
htable_transforms_release(&transforms);
}
@@ -97,26 +97,26 @@ main(int argc, char** argv)
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
/* ref_normal not in the YZ plane */
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
d3_splat(transl, +1);
d3(rot, 0, 0, PI / 2);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0.2, -1);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 1 axis tracking with a fixed output dir */
@@ -125,24 +125,24 @@ main(int argc, char** argv)
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
d3(tracking.data.out_dir.u, 1, 0, 1);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, -0.3, -1);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 1 axis tracking a target point */
@@ -153,24 +153,24 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 0, 0, 30);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0.1, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_SINGLE_AXIS;
@@ -179,24 +179,24 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 0, 10, 30);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0.1, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* same 1 axis tracking with a non-local target point */
@@ -207,24 +207,24 @@ main(int argc, char** argv)
d3(tracking.data.point.target, -10, 2, 32);
tracking.data.point.target_is_local = 0;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, -0.5, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_SINGLE_AXIS;
@@ -233,54 +233,54 @@ main(int argc, char** argv)
d3(tracking.data.point.target, -12, 2, -10);
tracking.data.point.target_is_local = 0;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0, -1);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 1 axis tracking a node target */
- CHECK(my_type_create(&allocator, &target), RES_OK);
+ CHK(my_type_create(&allocator, &target) == RES_OK);
d3(tmp, 0, 0, 10 * sqrt(2));
- CHECK(my_type_set_translation(target, tmp), RES_OK);
+ CHK(my_type_set_translation(target, tmp) == RES_OK);
d3(pivot.data.pivot1.ref_normal, 0, 0, 1);
d3(pivot.data.pivot1.ref_point, 0, 0, 0);
- CHECK(my_type_track_me(target, &tracking), RES_OK);
+ CHK(my_type_track_me(target, &tracking) == RES_OK);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0.1, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
- CHECK(my_type_ref_put(target), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
+ CHK(my_type_ref_put(target) == RES_OK);
/*
* 2 axis pivots
@@ -294,19 +294,19 @@ main(int argc, char** argv)
pivot.data.pivot2.spacing = 1;
d3(pivot.data.pivot2.ref_point, 0, 0, 1);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
d3_splat(transl, +1);
d3(rot, 0, 0, PI / 2);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0, -1);
check_visit(allocator, in_dir, t1, t2, t3);
@@ -314,9 +314,9 @@ main(int argc, char** argv)
d3(in_dir, 0, 1, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 2 axis tracking sun */
@@ -324,19 +324,19 @@ main(int argc, char** argv)
pivot.type = PIVOT_TWO_AXIS;
pivot.data.pivot2.spacing = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
d3_splat(transl, +1);
d3(rot, 0, 0, PI / 2);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 1, 0, -1);
check_visit(allocator, in_dir, t1, t2, t3);
@@ -344,9 +344,9 @@ main(int argc, char** argv)
d3(in_dir, 0, 1, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 2 axis tracking with a fixed output dir */
@@ -355,17 +355,17 @@ main(int argc, char** argv)
pivot.data.pivot2.spacing = 1;
d3(tracking.data.out_dir.u, 0, 1, 0);
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0, -1);
check_visit(allocator, in_dir, t1, t2, t3);
@@ -373,9 +373,9 @@ main(int argc, char** argv)
d3(in_dir, -1, 0, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
/* 2 axis tracking a target point */
@@ -386,24 +386,24 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 30, 0, 0);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, -1, 0, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_TWO_AXIS;
@@ -412,24 +412,24 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 30, -11, 0);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, -1, 0, 0);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_TWO_AXIS;
@@ -438,24 +438,24 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 0, 30, 10);
tracking.data.point.target_is_local = 1;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0, -1);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_TWO_AXIS;
@@ -464,24 +464,24 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 0, 30, 12);
tracking.data.point.target_is_local = 0;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0, -1);
check_visit(allocator, in_dir, t1, t2, t3);
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
tracking.policy = TRACKING_POINT;
pivot.type = PIVOT_TWO_AXIS;
@@ -490,27 +490,27 @@ main(int argc, char** argv)
d3(tracking.data.point.target, 10, 12, 15);
tracking.data.point.target_is_local = 0;
- CHECK(my_type_create(&allocator, &t1), RES_OK);
- CHECK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2), RES_OK);
- CHECK(my_type_create(&allocator, &t3), RES_OK);
+ CHK(my_type_create(&allocator, &t1) == RES_OK);
+ CHK(my_type_pivot_create(&allocator, &pivot, &tracking, &t2) == RES_OK);
+ CHK(my_type_create(&allocator, &t3) == RES_OK);
- CHECK(my_type_add_child(t1, t2), RES_OK);
- CHECK(my_type_add_child(t2, t3), RES_OK);
+ CHK(my_type_add_child(t1, t2) == RES_OK);
+ CHK(my_type_add_child(t2, t3) == RES_OK);
- CHECK(my_type_set_translation(t1, transl), RES_OK);
- CHECK(my_type_set_rotations(t1, rot), RES_OK);
- CHECK(my_type_set_translation(t2, transl), RES_OK);
- CHECK(my_type_set_translation(t3, transl), RES_OK);
+ CHK(my_type_set_translation(t1, transl) == RES_OK);
+ CHK(my_type_set_rotations(t1, rot) == RES_OK);
+ CHK(my_type_set_translation(t2, transl) == RES_OK);
+ CHK(my_type_set_translation(t3, transl) == RES_OK);
d3(in_dir, 0, 0, -1);
check_visit(allocator, in_dir, t1, t2, t3);
/* release memory */
- CHECK(my_type_ref_put(t1), RES_OK);
- CHECK(my_type_ref_put(t2), RES_OK);
- CHECK(my_type_ref_put(t3), RES_OK);
+ CHK(my_type_ref_put(t1) == RES_OK);
+ CHK(my_type_ref_put(t2) == RES_OK);
+ CHK(my_type_ref_put(t3) == RES_OK);
check_memory_allocator(&allocator);
mem_shutdown_proxy_allocator(&allocator);
- CHECK(mem_allocated_size(), 0);
+ CHK(mem_allocated_size() == 0);
return 0;
}