2015-03-03 00:38:33 +08:00
|
|
|
/****************************************************************************
|
2015-05-28 15:40:24 +08:00
|
|
|
** gmio
|
2015-05-01 00:19:45 +08:00
|
|
|
** Copyright Fougue (2 Mar. 2015)
|
2015-07-13 17:42:03 +08:00
|
|
|
** contact@fougue.pro
|
2015-03-03 00:38:33 +08:00
|
|
|
**
|
|
|
|
** This software is a reusable library whose purpose is to provide complete
|
|
|
|
** I/O support for various CAD file formats (eg. STL)
|
|
|
|
**
|
|
|
|
** This software is governed by the CeCILL-B license under French law and
|
|
|
|
** abiding by the rules of distribution of free software. You can use,
|
|
|
|
** modify and/ or redistribute the software under the terms of the CeCILL-B
|
|
|
|
** license as circulated by CEA, CNRS and INRIA at the following URL
|
2015-03-30 15:05:25 +08:00
|
|
|
** "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html".
|
2015-03-03 00:38:33 +08:00
|
|
|
****************************************************************************/
|
|
|
|
|
2015-12-04 01:00:25 +08:00
|
|
|
#include "utest_assert.h"
|
|
|
|
|
|
|
|
#include "../src/gmio_stl/stla_stats.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
static const char stl_jburkardt_sphere_filepath[] =
|
|
|
|
"models/solid_jburkardt_sphere.stla";
|
|
|
|
|
|
|
|
const char* test_stla_stats()
|
2013-03-06 18:49:53 +08:00
|
|
|
{
|
2015-12-04 01:00:25 +08:00
|
|
|
FILE* stla_file = fopen(stl_jburkardt_sphere_filepath, "rb");
|
|
|
|
struct gmio_rwargs rwargs = {0};
|
|
|
|
struct gmio_stla_stats stats = {0};
|
|
|
|
|
|
|
|
rwargs.memblock = gmio_memblock_malloc(8 * 1024); /* 8Ko */
|
|
|
|
rwargs.stream = gmio_stream_stdio(stla_file);
|
2014-03-13 21:37:55 +08:00
|
|
|
|
2015-12-04 01:00:25 +08:00
|
|
|
stats = gmio_stla_stats_get(&rwargs, GMIO_STLA_STAT_FLAG_ALL);
|
2015-04-02 22:08:11 +08:00
|
|
|
|
2015-12-04 01:00:25 +08:00
|
|
|
gmio_memblock_deallocate(&rwargs.memblock);
|
|
|
|
fclose(stla_file);
|
2014-02-13 19:02:40 +08:00
|
|
|
|
2015-12-04 01:00:25 +08:00
|
|
|
UTEST_ASSERT(stats.facet_count == 228);
|
|
|
|
/*UTEST_ASSERT(stats.size == 54297);*/
|
2013-03-06 18:49:53 +08:00
|
|
|
|
2015-12-04 01:00:25 +08:00
|
|
|
return NULL;
|
|
|
|
}
|