[Bf-blender-cvs] [47ae4c0] gtest-testing: rename tri -> tris

Campbell Barton noreply at git.blender.org
Tue May 27 16:37:52 CEST 2014


Commit: 47ae4c038841fd4e4af4994e3160467af27fd86a
Author: Campbell Barton
Date:   Wed May 28 00:37:15 2014 +1000
https://developer.blender.org/rB47ae4c038841fd4e4af4994e3160467af27fd86a

rename tri -> tris

===================================================================

M	source/tests/blenlib_tests/polyfill2d_test.cc

===================================================================

diff --git a/source/tests/blenlib_tests/polyfill2d_test.cc b/source/tests/blenlib_tests/polyfill2d_test.cc
index 343be66..5c69278 100644
--- a/source/tests/blenlib_tests/polyfill2d_test.cc
+++ b/source/tests/blenlib_tests/polyfill2d_test.cc
@@ -19,10 +19,10 @@ extern "C" {
 
 #define TRI_ERROR_VALUE (unsigned int)-1
 
-static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tri_tot)
+static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tris_tot)
 {
 	unsigned int i;
-	for (i = 0; i < tri_tot; i++) {
+	for (i = 0; i < tris_tot; i++) {
 		unsigned int j;
 		for (j = 0; j < 3; j++) {
 			tris[i][j] = TRI_ERROR_VALUE;
@@ -39,19 +39,19 @@ static void test_valid_polyfill_prepare(unsigned int tris[][3], unsigned int tri
  */
 static void test_polyfill_simple(
         const float poly[][2], const unsigned int poly_tot,
-        const unsigned int tri[][3], const unsigned int tri_tot)
+        const unsigned int tris[][3], const unsigned int tris_tot)
 {
 	unsigned int i;
 	int *tot_used = (int *)MEM_callocN(poly_tot * sizeof(int), __func__);
-	for (i = 0; i < tri_tot; i++) {
+	for (i = 0; i < tris_tot; i++) {
 		unsigned int j;
 		for (j = 0; j < 3; j++) {
-			EXPECT_NE(TRI_ERROR_VALUE, tri[i][j]);
-			tot_used[tri[i][j]] += 1;
+			EXPECT_NE(TRI_ERROR_VALUE, tris[i][j]);
+			tot_used[tris[i][j]] += 1;
 		}
-		EXPECT_NE(tri[i][0], tri[i][1]);
-		EXPECT_NE(tri[i][1], tri[i][2]);
-		EXPECT_NE(tri[i][2], tri[i][0]);
+		EXPECT_NE(tris[i][0], tris[i][1]);
+		EXPECT_NE(tris[i][1], tris[i][2]);
+		EXPECT_NE(tris[i][2], tris[i][0]);
 	}
 	for (i = 0; i < poly_tot; i++) {
 		EXPECT_NE(0, tot_used[i]);
@@ -61,16 +61,16 @@ static void test_polyfill_simple(
 
 static void  test_polyfill_topology(
         const float poly[][2], const unsigned int poly_tot,
-        const unsigned int tri[][3], const unsigned int tri_tot)
+        const unsigned int tris[][3], const unsigned int tris_tot)
 {
 	EdgeHash *edgehash = BLI_edgehash_new(__func__);
 	EdgeHashIterator *ehi;
 	unsigned int i;
-	for (i = 0; i < tri_tot; i++) {
+	for (i = 0; i < tris_tot; i++) {
 		unsigned int j;
 		for (j = 0; j < 3; j++) {
-			const unsigned int v1 = tri[i][j];
-			const unsigned int v2 = tri[i][(j + 1) % 3];
+			const unsigned int v1 = tris[i][j];
+			const unsigned int v2 = tris[i][(j + 1) % 3];
 			void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
 			if (p) {
 				*p = (void *)((intptr_t)*p + (intptr_t)1);
@@ -106,12 +106,12 @@ static void  test_polyfill_topology(
  */
 static void  test_polyfill_winding(
         const float poly[][2], const unsigned int poly_tot,
-        const unsigned int tri[][3], const unsigned int tri_tot)
+        const unsigned int tris[][3], const unsigned int tris_tot)
 {
 	unsigned int i;
 	unsigned int count[2] = {0, 0};
-	for (i = 0; i < tri_tot; i++) {
-		float winding_test = cross_tri_v2(poly[tri[i][0]], poly[tri[i][1]], poly[tri[i][2]]);
+	for (i = 0; i < tris_tot; i++) {
+		float winding_test = cross_tri_v2(poly[tris[i][0]], poly[tris[i][1]], poly[tris[i][2]]);
 		if (fabsf(winding_test) > FLT_EPSILON) {
 			count[winding_test < 0.0f] += 1;
 		}
@@ -124,17 +124,17 @@ static void  test_polyfill_winding(
  */
 static void test_polyfill_area(
         const float poly[][2], const unsigned int poly_tot,
-        const unsigned int tri[][3], const unsigned int tri_tot)
+        const unsigned int tris[][3], const unsigned int tris_tot)
 {
 	unsigned int i;
 	const float area_tot = area_poly_v2(poly, poly_tot);
-	float       area_tot_tri = 0.0f;
+	float       area_tot_tris = 0.0f;
 	const float eps_abs = 0.00001f;
 	const float eps = area_tot > 1.0f ? (area_tot * eps_abs) : eps_abs;
-	for (i = 0; i < tri_tot; i++) {
-		area_tot_tri += area_tri_v2(poly[tri[i][0]], poly[tri[i][1]], poly[tri[i][2]]);
+	for (i = 0; i < tris_tot; i++) {
+		area_tot_tris += area_tri_v2(poly[tris[i][0]], poly[tris[i][1]], poly[tris[i][2]]);
 	}
-	EXPECT_NEAR(area_tot, area_tot_tri, eps);
+	EXPECT_NEAR(area_tot, area_tot_tris, eps);
 }
 
 /**
@@ -166,7 +166,7 @@ static void test_polyfill_area(
 static void polyfill_to_obj(
         const char *id,
         const float poly[][2], const unsigned int poly_tot,
-        const unsigned int tri[][3], const unsigned int tri_tot)
+        const unsigned int tris[][3], const unsigned int tris_tot)
 {
 	char path[1024];
 	FILE *f;
@@ -183,8 +183,8 @@ static void polyfill_to_obj(
 		fprintf(f, "v %f %f 0.0\n", UNPACK2(poly[i]));
 	}
 
-	for (i = 0; i < tri_tot; i++) {
-		fprintf(f, "f %u %u %u\n", UNPACK3OP(1 +, tri[i]));
+	for (i = 0; i < tris_tot; i++) {
+		fprintf(f, "f %u %u %u\n", UNPACK3OP(1 +, tris[i]));
 	}
 
 	fclose(f);
@@ -193,11 +193,11 @@ static void polyfill_to_obj(
 static void polyfill_to_obj(
         const char *id,
         const float poly[][2], const unsigned int poly_tot,
-        const unsigned int tri[][3], const unsigned int tri_tot)
+        const unsigned int tris[][3], const unsigned int tris_tot)
 {
 	(void)id;
 	(void)poly, (void)poly_tot;
-	(void)tri, (void)tri_tot;
+	(void)tris, (void)tris_tot;
 }
 #endif  /* USE_OBJ_PREVIEW */




More information about the Bf-blender-cvs mailing list