star-cpr

Clip 2D meshes with 2D polygons
git clone git://git.meso-star.fr/star-cpr.git
Log | Files | Refs | README | LICENSE

commit 27843184c227471e5f2b2c7a0d949e099eeae2e8
parent 1d1557f943dee70e9b378a0462d1b1ea3b2ed84f
Author: Vincent Forest <vincent.forest@meos-star.com>
Date:   Tue, 12 Dec 2017 16:14:20 +0100

Merge branch 'release_0.1.1'

Diffstat:
MREADME.md | 7+++++++
Mcmake/CMakeLists.txt | 4++--
Msrc/test_scpr_clip.c | 58+++++++++++++++++++++++++++++-----------------------------
Msrc/test_scpr_mesh.c | 164++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc/test_scpr_utils.h | 16++++++++--------
5 files changed, 128 insertions(+), 121 deletions(-)

diff --git a/README.md b/README.md @@ -20,6 +20,13 @@ package as well as all the aforementioned prerequisites. Then generate the project from the `cmake/CMakeLists.txt` file by appending to the `CMAKE_PREFIX_PATH` variable the install directories of its dependencies. +## Release notes + +### Version 0.1.1 + +- Update the version of the RSys dependency to 0.6: replace the deprecated + `[N]CHECK` macros by the new macro `CHK`. + ## License Star-Clipper is Copyright (C) |Meso|Star> 2016 (<contact@meso-star.com>). It is diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -29,7 +29,7 @@ set(Clipper_DIR ${_current_source_dir}/) find_package(Clipper REQUIRED) find_package(RCMake REQUIRED) -find_package(RSys 0.4 REQUIRED) +find_package(RSys 0.6 REQUIRED) find_package(Polygon 0.0.5 REQUIRED) include_directories( @@ -48,7 +48,7 @@ rcmake_append_runtime_dirs(_runtime_dirs RSys Polygon) ################################################################################ set(VERSION_MAJOR 0) set(VERSION_MINOR 1) -set(VERSION_PATCH 0) +set(VERSION_PATCH 1) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(SCPR_FILES_SRC scpr_mesh.c) diff --git a/src/test_scpr_clip.c b/src/test_scpr_clip.c @@ -23,8 +23,8 @@ static void get_clip_pos(const size_t ivert, double pos[2], void* ctx) { const double* coords = ctx; - NCHECK(pos, NULL); - NCHECK(ctx, NULL); + CHK(pos != NULL); + CHK(ctx != NULL); pos[0] = coords[ivert*2+0]; pos[1] = coords[ivert*2+1]; } @@ -34,20 +34,20 @@ dump_obj(FILE* stream, const struct scpr_mesh* mesh) { size_t i, n; - NCHECK(stream, NULL); - NCHECK(mesh, NULL); + CHK(stream != NULL); + CHK(mesh != NULL); - CHECK(scpr_mesh_get_vertices_count(mesh, &n), RES_OK); + CHK(scpr_mesh_get_vertices_count(mesh, &n) == RES_OK); FOR_EACH(i, 0, n) { double pos[2]; - CHECK(scpr_mesh_get_position(mesh, i, pos), RES_OK); + CHK(scpr_mesh_get_position(mesh, i, pos) == RES_OK); fprintf(stream, "v %g %g 0\n", SPLIT2(pos)); } - CHECK(scpr_mesh_get_triangles_count(mesh, &n), RES_OK); + CHK(scpr_mesh_get_triangles_count(mesh, &n) == RES_OK); FOR_EACH(i, 0, n) { size_t ids[3]; - CHECK(scpr_mesh_get_indices(mesh, i, ids), RES_OK); + CHK(scpr_mesh_get_indices(mesh, i, ids) == RES_OK); fprintf(stream, "f %lu %lu %lu\n", (unsigned long)(ids[0] + 1), (unsigned long)(ids[1] + 1), @@ -69,25 +69,25 @@ test_triangle(struct scpr_mesh* mesh) ctx.nverts = 3; ctx.indices = triangle_ids; ctx.ntris = 1; - CHECK(scpr_mesh_setup_indexed_vertices - (mesh, ctx.ntris, get_ids, 3, get_pos, &ctx), RES_OK); + CHK(scpr_mesh_setup_indexed_vertices + (mesh, ctx.ntris, get_ids, 3, get_pos, &ctx) == RES_OK); poly.get_position = get_clip_pos; poly.nvertices = sizeof(clip_pos)/sizeof(double[2]); poly.context = (void*)clip_pos; - CHECK(scpr_mesh_clip(NULL, SCPR_OPERATIONS_COUNT__, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_clip(mesh, SCPR_OPERATIONS_COUNT__, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_clip(NULL, SCPR_OPERATIONS_COUNT__, &poly), RES_BAD_ARG); - CHECK(scpr_mesh_clip(mesh, SCPR_OPERATIONS_COUNT__, &poly), RES_BAD_ARG); - CHECK(scpr_mesh_clip(NULL, SCPR_SUB, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_clip(mesh, SCPR_SUB, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_clip(NULL, SCPR_SUB, &poly), RES_BAD_ARG); - CHECK(scpr_mesh_clip(mesh, SCPR_SUB, &poly), RES_OK); + CHK(scpr_mesh_clip(NULL, SCPR_OPERATIONS_COUNT__, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_clip(mesh, SCPR_OPERATIONS_COUNT__, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_clip(NULL, SCPR_OPERATIONS_COUNT__, &poly) == RES_BAD_ARG); + CHK(scpr_mesh_clip(mesh, SCPR_OPERATIONS_COUNT__, &poly) == RES_BAD_ARG); + CHK(scpr_mesh_clip(NULL, SCPR_SUB, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_clip(mesh, SCPR_SUB, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_clip(NULL, SCPR_SUB, &poly) == RES_BAD_ARG); + CHK(scpr_mesh_clip(mesh, SCPR_SUB, &poly) == RES_OK); /*dump_obj(stdout, mesh);*/ - CHECK(scpr_mesh_get_triangles_count(mesh, &ntris), RES_OK); - CHECK(ntris, 3); + CHK(scpr_mesh_get_triangles_count(mesh, &ntris) == RES_OK); + CHK(ntris == 3); } static void @@ -103,13 +103,13 @@ test_quad(struct scpr_mesh* mesh) ctx.nverts = sizeof(quad_pos)/sizeof(double[2]); ctx.indices = quad_ids; ctx.ntris = sizeof(quad_ids)/sizeof(size_t[3]); - CHECK(scpr_mesh_setup_indexed_vertices - (mesh, ctx.ntris, get_ids, ctx.nverts, get_pos, &ctx), RES_OK); + CHK(scpr_mesh_setup_indexed_vertices + (mesh, ctx.ntris, get_ids, ctx.nverts, get_pos, &ctx) == RES_OK); poly.get_position = get_clip_pos; poly.nvertices = sizeof(clip_pos)/sizeof(double[2]); poly.context = (void*)clip_pos; - CHECK(scpr_mesh_clip(mesh, SCPR_AND, &poly), RES_OK); + CHK(scpr_mesh_clip(mesh, SCPR_AND, &poly) == RES_OK); /*dump_obj(stdout, mesh);*/ } @@ -176,13 +176,13 @@ test_disk(struct scpr_mesh* mesh) ctx.nverts = sa_size(pos)/2; ctx.indices = ids; ctx.ntris = sa_size(ids)/3; - CHECK(scpr_mesh_setup_indexed_vertices - (mesh, ctx.ntris, get_ids, ctx.nverts, get_pos, &ctx), RES_OK); + CHK(scpr_mesh_setup_indexed_vertices + (mesh, ctx.ntris, get_ids, ctx.nverts, get_pos, &ctx) == RES_OK); poly.get_position = get_clip_pos; poly.nvertices = sizeof(clip)/sizeof(double[2]); poly.context = (void*)clip; - CHECK(scpr_mesh_clip(mesh, SCPR_SUB, &poly), RES_OK); + CHK(scpr_mesh_clip(mesh, SCPR_SUB, &poly) == RES_OK); dump_obj(stdout, mesh); @@ -199,17 +199,17 @@ main(int argc, char** argv) mem_init_proxy_allocator(&allocator, &mem_default_allocator); - CHECK(scpr_mesh_create(&allocator, &mesh), RES_OK); + CHK(scpr_mesh_create(&allocator, &mesh) == RES_OK); test_triangle(mesh); test_quad(mesh); test_disk(mesh); - CHECK(scpr_mesh_ref_put(mesh), RES_OK); + CHK(scpr_mesh_ref_put(mesh) == 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_scpr_mesh.c b/src/test_scpr_mesh.c @@ -53,17 +53,17 @@ main(int argc, char** argv) mem_init_proxy_allocator(&allocator, &mem_default_allocator); - CHECK(scpr_mesh_create(NULL, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_create(&allocator, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_create(NULL, &mesh), RES_OK); + CHK(scpr_mesh_create(NULL, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_create(&allocator, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_create(NULL, &mesh) == RES_OK); - CHECK(scpr_mesh_ref_get(NULL), RES_BAD_ARG); - CHECK(scpr_mesh_ref_get(mesh), RES_OK); - CHECK(scpr_mesh_ref_put(NULL), RES_BAD_ARG); - CHECK(scpr_mesh_ref_put(mesh), RES_OK); - CHECK(scpr_mesh_ref_put(mesh), RES_OK); + CHK(scpr_mesh_ref_get(NULL) == RES_BAD_ARG); + CHK(scpr_mesh_ref_get(mesh) == RES_OK); + CHK(scpr_mesh_ref_put(NULL) == RES_BAD_ARG); + CHK(scpr_mesh_ref_put(mesh) == RES_OK); + CHK(scpr_mesh_ref_put(mesh) == RES_OK); - CHECK(scpr_mesh_create(&allocator, &mesh), RES_OK); + CHK(scpr_mesh_create(&allocator, &mesh) == RES_OK); ctx.coords = coords; ctx.nverts = nverts; @@ -71,94 +71,94 @@ main(int argc, char** argv) ctx.ntris = ntris; #define SETUP scpr_mesh_setup_indexed_vertices - CHECK(SETUP(NULL, 0, NULL, 0, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, 0, NULL, 0, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, ntris, NULL, 0, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, ntris, NULL, 0, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, 0, get_ids, 0, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, 0, get_ids, 0, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, ntris, get_ids, 0, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, ntris, get_ids, 0, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, 0, NULL, nverts, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, 0, NULL, nverts, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, ntris, NULL, nverts, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, ntris, NULL, nverts, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, 0, get_ids, nverts, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, 0, get_ids, nverts, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, ntris, get_ids, nverts, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, ntris, get_ids, nverts, NULL, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, 0, NULL, 0, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, 0, NULL, 0, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, ntris, NULL, 0, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, ntris, NULL, 0, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, 0, get_ids, 0, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, 0, get_ids, 0, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, ntris, get_ids, 0, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, ntris, get_ids, 0, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, 0, NULL, nverts, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, 0, NULL, nverts, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, ntris, NULL, nverts, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, ntris, NULL, nverts, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, 0, get_ids, nverts, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, 0, get_ids, nverts, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(NULL, ntris, get_ids, nverts, get_pos, &ctx), RES_BAD_ARG); - CHECK(SETUP(mesh, ntris, get_ids, nverts, get_pos, &ctx), RES_OK); + CHK(SETUP(NULL, 0, NULL, 0, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, 0, NULL, 0, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, ntris, NULL, 0, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, ntris, NULL, 0, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, 0, get_ids, 0, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, 0, get_ids, 0, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, ntris, get_ids, 0, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, ntris, get_ids, 0, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, 0, NULL, nverts, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, 0, NULL, nverts, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, ntris, NULL, nverts, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, ntris, NULL, nverts, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, 0, get_ids, nverts, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, 0, get_ids, nverts, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, ntris, get_ids, nverts, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, ntris, get_ids, nverts, NULL, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, 0, NULL, 0, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, 0, NULL, 0, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, ntris, NULL, 0, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, ntris, NULL, 0, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, 0, get_ids, 0, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, 0, get_ids, 0, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, ntris, get_ids, 0, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, ntris, get_ids, 0, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, 0, NULL, nverts, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, 0, NULL, nverts, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, ntris, NULL, nverts, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, ntris, NULL, nverts, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, 0, get_ids, nverts, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, 0, get_ids, nverts, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(NULL, ntris, get_ids, nverts, get_pos, &ctx) == RES_BAD_ARG); + CHK(SETUP(mesh, ntris, get_ids, nverts, get_pos, &ctx) == RES_OK); ctx.indices = indices_bad; - CHECK(SETUP(mesh, 1, get_ids, nverts, get_pos, &ctx), RES_BAD_ARG); + CHK(SETUP(mesh, 1, get_ids, nverts, get_pos, &ctx) == RES_BAD_ARG); #undef SETUP - CHECK(scpr_mesh_get_triangles_count(NULL, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_triangles_count(mesh, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_triangles_count(NULL, &n), RES_BAD_ARG); - CHECK(scpr_mesh_get_triangles_count(mesh, &n), RES_OK); - CHECK(n, 0); + CHK(scpr_mesh_get_triangles_count(NULL, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_triangles_count(mesh, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_triangles_count(NULL, &n) == RES_BAD_ARG); + CHK(scpr_mesh_get_triangles_count(mesh, &n) == RES_OK); + CHK(n == 0); - CHECK(scpr_mesh_get_vertices_count(NULL, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_vertices_count(mesh, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_vertices_count(NULL, &n), RES_BAD_ARG); - CHECK(scpr_mesh_get_vertices_count(mesh, &n), RES_OK); - CHECK(n, 0); + CHK(scpr_mesh_get_vertices_count(NULL, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_vertices_count(mesh, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_vertices_count(NULL, &n) == RES_BAD_ARG); + CHK(scpr_mesh_get_vertices_count(mesh, &n) == RES_OK); + CHK(n == 0); ctx.indices = indices; - CHECK(scpr_mesh_setup_indexed_vertices - (mesh, ntris, get_ids, nverts, get_pos, &ctx), RES_OK); - CHECK(scpr_mesh_get_triangles_count(mesh, &n), RES_OK); - CHECK(n, ntris); - CHECK(scpr_mesh_get_vertices_count(mesh, &n), RES_OK); - CHECK(n, nverts); - - CHECK(scpr_mesh_get_indices(NULL, ntris, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_indices(mesh, ntris, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_indices(NULL, 0, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_indices(mesh, 0, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_indices(NULL, ntris, ids), RES_BAD_ARG); - CHECK(scpr_mesh_get_indices(mesh, ntris, ids), RES_BAD_ARG); - CHECK(scpr_mesh_get_indices(NULL, 0, ids), RES_BAD_ARG); + CHK(scpr_mesh_setup_indexed_vertices + (mesh, ntris, get_ids, nverts, get_pos, &ctx) == RES_OK); + CHK(scpr_mesh_get_triangles_count(mesh, &n) == RES_OK); + CHK(n == ntris); + CHK(scpr_mesh_get_vertices_count(mesh, &n) == RES_OK); + CHK(n == nverts); + + CHK(scpr_mesh_get_indices(NULL, ntris, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_indices(mesh, ntris, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_indices(NULL, 0, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_indices(mesh, 0, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_indices(NULL, ntris, ids) == RES_BAD_ARG); + CHK(scpr_mesh_get_indices(mesh, ntris, ids) == RES_BAD_ARG); + CHK(scpr_mesh_get_indices(NULL, 0, ids) == RES_BAD_ARG); FOR_EACH(i, 0, ntris) { - CHECK(scpr_mesh_get_indices(mesh, i, ids), RES_OK); - CHECK(ids[0], indices[i*3+0]); - CHECK(ids[1], indices[i*3+1]); - CHECK(ids[2], indices[i*3+2]); + CHK(scpr_mesh_get_indices(mesh, i, ids) == RES_OK); + CHK(ids[0] == indices[i*3+0]); + CHK(ids[1] == indices[i*3+1]); + CHK(ids[2] == indices[i*3+2]); } - CHECK(scpr_mesh_get_position(NULL, nverts, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_position(mesh, nverts, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_position(NULL, 0, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_position(mesh, 0, NULL), RES_BAD_ARG); - CHECK(scpr_mesh_get_position(NULL, nverts, pos), RES_BAD_ARG); - CHECK(scpr_mesh_get_position(mesh, nverts, pos), RES_BAD_ARG); - CHECK(scpr_mesh_get_position(NULL, 0, pos), RES_BAD_ARG); + CHK(scpr_mesh_get_position(NULL, nverts, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_position(mesh, nverts, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_position(NULL, 0, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_position(mesh, 0, NULL) == RES_BAD_ARG); + CHK(scpr_mesh_get_position(NULL, nverts, pos) == RES_BAD_ARG); + CHK(scpr_mesh_get_position(mesh, nverts, pos) == RES_BAD_ARG); + CHK(scpr_mesh_get_position(NULL, 0, pos) == RES_BAD_ARG); FOR_EACH(i, 0, nverts) { - CHECK(scpr_mesh_get_position(mesh, i, pos), RES_OK); - CHECK(pos[0], coords[i*2+0]); - CHECK(pos[1], coords[i*2+1]); + CHK(scpr_mesh_get_position(mesh, i, pos) == RES_OK); + CHK(pos[0] == coords[i*2+0]); + CHK(pos[1] == coords[i*2+1]); } - CHECK(scpr_mesh_ref_put(mesh), RES_OK); + CHK(scpr_mesh_ref_put(mesh) == 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_scpr_utils.h b/src/test_scpr_utils.h @@ -30,10 +30,10 @@ static void get_pos(const size_t ivert, double pos[2], void* context) { const struct mesh_context* ctx = context; - NCHECK(pos, NULL); - NCHECK(context, NULL); - NCHECK(ctx->coords, NULL); - CHECK(ivert < ctx->nverts, 1); + CHK(pos != NULL); + CHK(context != NULL); + CHK(ctx->coords != NULL); + CHK(ivert < ctx->nverts); pos[0] = ctx->coords[ivert*2 + 0]; pos[1] = ctx->coords[ivert*2 + 1]; } @@ -42,10 +42,10 @@ static void get_ids(const size_t itri, size_t ids[3], void* context) { const struct mesh_context* ctx = context; - NCHECK(ids, NULL); - NCHECK(context, NULL); - NCHECK(ctx->indices, NULL); - CHECK(itri < ctx->ntris, 1); + CHK(ids != NULL); + CHK(context != NULL); + CHK(ctx->indices != NULL); + CHK(itri < ctx->ntris); ids[0] = ctx->indices[itri*3 + 0]; ids[1] = ctx->indices[itri*3 + 1]; ids[2] = ctx->indices[itri*3 + 2];