Fix gtests on Windows/MSVC

There were some missing stubs and some tests were specifically
written for Linux. Also, apparently MSVC has a limit of 64K for
the insource strings..
This commit is contained in:
Sergey Sharybin
2016-02-06 21:19:47 +05:00
parent 5508cc2d63
commit 2dba2b3d71
6 changed files with 27 additions and 3 deletions

View File

@@ -339,7 +339,8 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nb
{
printf("\n========== STARTING %s ==========\n", id);
unsigned int (*data)[4] = (unsigned int (*)[4])MEM_mallocN(sizeof(*data) * (size_t)nbr, __func__);
void *data_v = MEM_mallocN(sizeof(unsigned int (*)[4]) * (size_t)nbr, __func__);
unsigned int (*data)[4] = (unsigned int (*)[4])data_v;
unsigned int (*dt)[4];
unsigned int i, j;

View File

@@ -6,6 +6,11 @@ extern "C" {
#include "BLI_fileops.h"
#include "BLI_path_util.h"
#include "../../../source/blender/imbuf/IMB_imbuf.h"
#ifdef _WIN32
# include "../../../source/blender/blenkernel/BKE_global.h"
#endif
}
/* -------------------------------------------------------------------- */
@@ -13,6 +18,10 @@ extern "C" {
extern "C" {
#if _WIN32
Global G = {0};
#endif
const char *GHOST_getUserDir(int version, const char *versionstr);
const char *GHOST_getSystemDir(int version, const char *versionstr);
#ifdef __linux__
@@ -47,6 +56,7 @@ char *zLhm65070058860608_br_find_exe(const char *default_exe)
/* tests */
/* BLI_cleanup_path */
#ifndef _WIN32
TEST(path_util, PathUtilClean)
{
/* "/./" -> "/" */
@@ -101,6 +111,7 @@ TEST(path_util, PathUtilClean)
EXPECT_STREQ("/a/b/", path);
}
}
#endif
/* BLI_path_frame */
TEST(path_util, PathUtilFrame)

View File

@@ -579,6 +579,7 @@ const char words10k[] =
"arcu. Integer ut tellus ac sapien maximus tincidunt sed vitae risus. Nulla viverra, nibh eget eleifend aliquam, quam "
"quam tempor massa, eu semper ipsum lacus in turpis. Nulla sed purus enim. Nullam sed fermentum ipsum. Sed dui nisi, "
"elementum a auctor at, ultrices et nibh. Phasellus aliquam nulla ut lacinia accumsan. Phasellus sed arcu ligula. "
#ifndef _MSC_VER
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam fermentum magna vitae dui sagittis tempor. Vivamus "
"eu ligula blandit, imperdiet arcu at, rutrum sem. Aliquam erat volutpat. Quisque luctus enim quis volutpat lobortis. "
"Vestibulum eget sodales libero. Aenean at condimentum est. Proin eget massa vel nulla efficitur tempor eget at enim. "
@@ -597,6 +598,8 @@ const char words10k[] =
"sit amet porta risus hendrerit non. Aenean id sem nisi. Nullam non nisl vestibulum, pellentesque nisl et, imperdiet "
"ligula. Sed laoreet fringilla felis. Proin ac dolor viverra tellus mollis aliquet eget et neque. Suspendisse mattis "
"nulla vitae nulla sagittis blandit. Sed at tortor rutrum, ornare magna nec, pellentesque nisi. Etiam non aliquet "
"tellus. Aliquam at ex suscipit, posuere sem sit amet, tincidunt.";
"tellus. Aliquam at ex suscipit, posuere sem sit amet, tincidunt."
#endif
;
#endif /* __BLENDER_TESTING_BLI_RESSOURCE_STRING_H__ */

View File

@@ -41,7 +41,11 @@ BLENDER_TEST(BLI_math_color "bf_blenlib")
BLENDER_TEST(BLI_math_geom "bf_blenlib;bf_intern_eigen")
BLENDER_TEST(BLI_math_base "bf_blenlib")
BLENDER_TEST(BLI_string "bf_blenlib")
BLENDER_TEST(BLI_path_util "bf_blenlib;extern_wcwidth;${ZLIB_LIBRARIES}")
if(WIN32)
BLENDER_TEST(BLI_path_util "bf_blenlib;bf_intern_utfconv;extern_wcwidth;${ZLIB_LIBRARIES}")
else()
BLENDER_TEST(BLI_path_util "bf_blenlib;extern_wcwidth;${ZLIB_LIBRARIES}")
endif()
BLENDER_TEST(BLI_polyfill2d "bf_blenlib;bf_intern_eigen")
BLENDER_TEST(BLI_listbase "bf_blenlib")
BLENDER_TEST(BLI_hash_mm2a "bf_blenlib")

View File

@@ -25,6 +25,7 @@ set(INC
.
..
../../../intern/guardedalloc
../../../source/blender/blenlib
)
include_directories(${INC})

View File

@@ -2,6 +2,10 @@
#include "testing/testing.h"
extern "C" {
#include "BLI_utildefines.h"
}
#include "MEM_guardedalloc.h"
#define CHECK_ALIGNMENT(ptr, align) EXPECT_EQ(0, (size_t)ptr % align)