Commit 09e02eda authored by Méso Star's avatar Méso Star

Merge branch 'release_0.3.1'

parents 4b6a1f6f 1f65ba09
...@@ -23,7 +23,7 @@ as any CMake project. ...@@ -23,7 +23,7 @@ as any CMake project.
## License ## License
Star-3DSTL is Copyright (C) |Meso|Star> 2015-2016 (<contact@meso-star.com>). Star-3DSTL is Copyright (C) |Meso|Star> 2015-2018 (<contact@meso-star.com>).
It is a free software released under the [OSI](http://opensource.org)-approved It is a free software released under the [OSI](http://opensource.org)-approved
CeCILL license. You are welcome to redistribute it under certain conditions; CeCILL license. You are welcome to redistribute it under certain conditions;
refer to the COPYING files for details. refer to the COPYING files for details.
......
# Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com) # Copyright (C) |Meso|Star> 2015-2018 (contact@meso-star.com)
# #
# This software is governed by the CeCILL license under French law and # This software is governed by the CeCILL license under French law and
# abiding by the rules of distribution of free software. You can use, # abiding by the rules of distribution of free software. You can use,
...@@ -65,7 +65,7 @@ target_link_libraries(s3dstl RSys Star3D StarSTL) ...@@ -65,7 +65,7 @@ target_link_libraries(s3dstl RSys Star3D StarSTL)
set(VERSION_MAJOR 0) set(VERSION_MAJOR 0)
set(VERSION_MINOR 3) set(VERSION_MINOR 3)
set(VERSION_PATCH 0) set(VERSION_PATCH 1)
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
set_target_properties(s3dstl PROPERTIES set_target_properties(s3dstl PROPERTIES
DEFINE_SYMBOL S3DSTL_SHARED_BUILD DEFINE_SYMBOL S3DSTL_SHARED_BUILD
......
/* Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com) /* Copyright (C) |Meso|Star> 2015-2018 (contact@meso-star.com)
* *
* This software is governed by the CeCILL license under French law and * This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use, * abiding by the rules of distribution of free software. You can use,
......
/* Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com) /* Copyright (C) |Meso|Star> 2015-2018 (contact@meso-star.com)
* *
* This software is governed by the CeCILL license under French law and * This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use, * abiding by the rules of distribution of free software. You can use,
......
/* Copyright (C) |Meso|Star> 2015-2016 (contact@meso-star.com) /* Copyright (C) |Meso|Star> 2015-2018 (contact@meso-star.com)
* *
* This software is governed by the CeCILL license under French law and * This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use, * abiding by the rules of distribution of free software. You can use,
...@@ -142,52 +142,52 @@ test_load(struct s3dstl* s3dstl) ...@@ -142,52 +142,52 @@ test_load(struct s3dstl* s3dstl)
size_t i; size_t i;
file = fopen("test_empty.stl", "w"); file = fopen("test_empty.stl", "w");
NCHECK(file, NULL); CHK(file != NULL);
fwrite(test0, sizeof(char), strlen(test0), file); fwrite(test0, sizeof(char), strlen(test0), file);
fclose(file); fclose(file);
CHECK(s3dstl_load(NULL, NULL), RES_BAD_ARG); CHK(s3dstl_load(NULL, NULL) == RES_BAD_ARG);
CHECK(s3dstl_load(s3dstl, NULL), RES_BAD_ARG); CHK(s3dstl_load(s3dstl, NULL) == RES_BAD_ARG);
CHECK(s3dstl_load(NULL, "test_empty.stl"), RES_BAD_ARG); CHK(s3dstl_load(NULL, "test_empty.stl") == RES_BAD_ARG);
CHECK(s3dstl_load(s3dstl, "test_none.stl"), RES_IO_ERR); CHK(s3dstl_load(s3dstl, "test_none.stl") == RES_IO_ERR);
CHECK(s3dstl_load(s3dstl, "test_empty.stl"), RES_OK); CHK(s3dstl_load(s3dstl, "test_empty.stl") == RES_OK);
CHECK(s3dstl_get_shape(NULL, NULL), RES_BAD_ARG); CHK(s3dstl_get_shape(NULL, NULL) == RES_BAD_ARG);
CHECK(s3dstl_get_shape(s3dstl, NULL), RES_BAD_ARG); CHK(s3dstl_get_shape(s3dstl, NULL) == RES_BAD_ARG);
CHECK(s3dstl_get_shape(NULL, &shape), RES_BAD_ARG); CHK(s3dstl_get_shape(NULL, &shape) == RES_BAD_ARG);
CHECK(s3dstl_get_shape(s3dstl, &shape), RES_OK); CHK(s3dstl_get_shape(s3dstl, &shape) == RES_OK);
CHECK(shape, NULL); CHK(shape == NULL);
file = tmpfile(); file = tmpfile();
FOR_EACH(i, 0, cube_nlines) FOR_EACH(i, 0, cube_nlines)
fwrite(cube[i], sizeof(char), strlen(cube[i]), file); fwrite(cube[i], sizeof(char), strlen(cube[i]), file);
rewind(file); rewind(file);
CHECK(s3dstl_load_stream(NULL, NULL), RES_BAD_ARG); CHK(s3dstl_load_stream(NULL, NULL) == RES_BAD_ARG);
CHECK(s3dstl_load_stream(s3dstl, NULL), RES_BAD_ARG); CHK(s3dstl_load_stream(s3dstl, NULL) == RES_BAD_ARG);
CHECK(s3dstl_load_stream(NULL, file), RES_BAD_ARG); CHK(s3dstl_load_stream(NULL, file) == RES_BAD_ARG);
CHECK(s3dstl_load_stream(s3dstl, file), RES_OK); CHK(s3dstl_load_stream(s3dstl, file) == RES_OK);
CHECK(s3dstl_get_shape(s3dstl, &shape), RES_OK); CHK(s3dstl_get_shape(s3dstl, &shape) == RES_OK);
NCHECK(shape, NULL); CHK(shape != NULL);
file2 = tmpfile(); file2 = tmpfile();
NCHECK(file2, NULL); CHK(file2 != NULL);
fwrite(bad, sizeof(char), strlen(bad), file2); fwrite(bad, sizeof(char), strlen(bad), file2);
rewind(file2); rewind(file2);
CHECK(s3dstl_load_stream(s3dstl, file2), RES_BAD_ARG); CHK(s3dstl_load_stream(s3dstl, file2) == RES_BAD_ARG);
CHECK(s3dstl_get_shape(s3dstl, &shape2), RES_OK); CHK(s3dstl_get_shape(s3dstl, &shape2) == RES_OK);
CHECK(shape, shape2); CHK(shape == shape2);
rewind(file); rewind(file);
CHECK(s3dstl_load_stream(s3dstl, file), RES_OK); CHK(s3dstl_load_stream(s3dstl, file) == RES_OK);
CHECK(s3dstl_get_shape(s3dstl, &shape), RES_OK); CHK(s3dstl_get_shape(s3dstl, &shape) == RES_OK);
NCHECK(shape, NULL); CHK(shape != NULL);
CHECK(s3dstl_clear(NULL), RES_BAD_ARG); CHK(s3dstl_clear(NULL) == RES_BAD_ARG);
CHECK(s3dstl_clear(s3dstl), RES_OK); CHK(s3dstl_clear(s3dstl) == RES_OK);
CHECK(s3dstl_get_shape(s3dstl, &shape), RES_OK); CHK(s3dstl_get_shape(s3dstl, &shape) == RES_OK);
CHECK(shape, NULL); CHK(shape == NULL);
} }
int int
...@@ -202,45 +202,45 @@ main(int argc, char** argv) ...@@ -202,45 +202,45 @@ main(int argc, char** argv)
mem_init_proxy_allocator(&allocator_proxy, &mem_default_allocator); mem_init_proxy_allocator(&allocator_proxy, &mem_default_allocator);
CHECK(s3d_device_create(NULL, &allocator_proxy, 0, &s3d), RES_OK); CHK(s3d_device_create(NULL, &allocator_proxy, 0, &s3d) == RES_OK);
CHECK(s3dstl_create(NULL, NULL, NULL, NULL, 1, NULL), RES_BAD_ARG); CHK(s3dstl_create(NULL, NULL, NULL, NULL, 1, NULL) == RES_BAD_ARG);
CHECK(s3dstl_create(NULL, NULL, NULL, NULL, 1, &s3dstl), RES_BAD_ARG); CHK(s3dstl_create(NULL, NULL, NULL, NULL, 1, &s3dstl) == RES_BAD_ARG);
CHECK(s3dstl_create(NULL, NULL, NULL, s3d, 1, NULL), RES_BAD_ARG); CHK(s3dstl_create(NULL, NULL, NULL, s3d, 1, NULL) == RES_BAD_ARG);
CHECK(s3dstl_create(NULL, NULL, NULL, s3d, 1, &s3dstl), RES_OK); CHK(s3dstl_create(NULL, NULL, NULL, s3d, 1, &s3dstl) == RES_OK);
CHECK(s3dstl_ref_get(NULL), RES_BAD_ARG); CHK(s3dstl_ref_get(NULL) == RES_BAD_ARG);
CHECK(s3dstl_ref_get(s3dstl), RES_OK); CHK(s3dstl_ref_get(s3dstl) == RES_OK);
CHECK(s3dstl_ref_put(NULL), RES_BAD_ARG); CHK(s3dstl_ref_put(NULL) == RES_BAD_ARG);
CHECK(s3dstl_ref_put(s3dstl), RES_OK); CHK(s3dstl_ref_put(s3dstl) == RES_OK);
CHECK(s3dstl_ref_put(s3dstl), RES_OK); CHK(s3dstl_ref_put(s3dstl) == RES_OK);
CHECK(s3dstl_create(NULL, &allocator_proxy, NULL, NULL, 1, NULL), RES_BAD_ARG); CHK(s3dstl_create(NULL, &allocator_proxy, NULL, NULL, 1, NULL) == RES_BAD_ARG);
CHECK(s3dstl_create(NULL, &allocator_proxy, NULL, NULL, 1, &s3dstl), RES_BAD_ARG); CHK(s3dstl_create(NULL, &allocator_proxy, NULL, NULL, 1, &s3dstl) == RES_BAD_ARG);
CHECK(s3dstl_create(NULL, &allocator_proxy, NULL, s3d, 1, NULL), RES_BAD_ARG); CHK(s3dstl_create(NULL, &allocator_proxy, NULL, s3d, 1, NULL) == RES_BAD_ARG);
CHECK(s3dstl_create(NULL, &allocator_proxy, NULL, s3d, 1, &s3dstl), RES_OK); CHK(s3dstl_create(NULL, &allocator_proxy, NULL, s3d, 1, &s3dstl) == RES_OK);
CHECK(s3dstl_ref_put(s3dstl), RES_OK); CHK(s3dstl_ref_put(s3dstl) == RES_OK);
CHECK(s3dstl_create CHK(s3dstl_create
(LOGGER_DEFAULT, &allocator_proxy, NULL, s3d, 1, &s3dstl), RES_OK); (LOGGER_DEFAULT, &allocator_proxy, NULL, s3d, 1, &s3dstl) == RES_OK);
CHECK(s3dstl_get_sstl(NULL, NULL), RES_BAD_ARG); CHK(s3dstl_get_sstl(NULL, NULL) == RES_BAD_ARG);
CHECK(s3dstl_get_sstl(s3dstl, NULL), RES_BAD_ARG); CHK(s3dstl_get_sstl(s3dstl, NULL) == RES_BAD_ARG);
CHECK(s3dstl_get_sstl(NULL, &sstl), RES_BAD_ARG); CHK(s3dstl_get_sstl(NULL, &sstl) == RES_BAD_ARG);
CHECK(s3dstl_get_sstl(s3dstl, &sstl), RES_OK); CHK(s3dstl_get_sstl(s3dstl, &sstl) == RES_OK);
CHECK(s3dstl_ref_put(s3dstl), RES_OK); CHK(s3dstl_ref_put(s3dstl) == RES_OK);
CHECK(sstl_create(NULL, &allocator_proxy, 1, &sstl), RES_OK); CHK(sstl_create(NULL, &allocator_proxy, 1, &sstl) == RES_OK);
CHECK(s3dstl_create(NULL, &allocator_proxy, sstl, s3d, 1, &s3dstl), RES_OK); CHK(s3dstl_create(NULL, &allocator_proxy, sstl, s3d, 1, &s3dstl) == RES_OK);
CHECK(s3dstl_get_sstl(s3dstl, &sstl2), RES_OK); CHK(s3dstl_get_sstl(s3dstl, &sstl2) == RES_OK);
CHECK(sstl, sstl2); CHK(sstl == sstl2);
test_load(s3dstl); test_load(s3dstl);
CHECK(s3dstl_ref_put(s3dstl), RES_OK); CHK(s3dstl_ref_put(s3dstl) == RES_OK);
CHECK(s3d_device_ref_put(s3d), RES_OK); CHK(s3d_device_ref_put(s3d) == RES_OK);
CHECK(sstl_ref_put(sstl), RES_OK); CHK(sstl_ref_put(sstl) == RES_OK);
if(MEM_ALLOCATED_SIZE(&allocator_proxy)) { if(MEM_ALLOCATED_SIZE(&allocator_proxy)) {
char dump[512]; char dump[512];
...@@ -249,7 +249,7 @@ main(int argc, char** argv) ...@@ -249,7 +249,7 @@ main(int argc, char** argv)
FATAL("Memory leaks\n"); FATAL("Memory leaks\n");
} }
mem_shutdown_proxy_allocator(&allocator_proxy); mem_shutdown_proxy_allocator(&allocator_proxy);
CHECK(mem_allocated_size(), 0); CHK(mem_allocated_size() == 0);
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment