Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIsh Bosamiya <ish_bosamiya>2020-03-02 16:52:58 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2020-03-02 17:02:26 +0300
commit5afa4b1dc8aacdd17f72a2bcaccd53838107c229 (patch)
tree5c57184327e0dc9c27b5af0451f0014f9502908d /tests
parent1648a7903672604dca096d49b282cf737dd9e661 (diff)
Fix T65568: sewing and self collision issue
As explained in T65568 by @LucaRood, the self collision system should exclude triangles that are connected by sewing springs. Differential Revision: https://developer.blender.org/D6911
Diffstat (limited to 'tests')
-rw-r--r--tests/gtests/blenlib/BLI_ghash_performance_test.cc107
1 files changed, 107 insertions, 0 deletions
diff --git a/tests/gtests/blenlib/BLI_ghash_performance_test.cc b/tests/gtests/blenlib/BLI_ghash_performance_test.cc
index 58dd9998733..631adfc7a6b 100644
--- a/tests/gtests/blenlib/BLI_ghash_performance_test.cc
+++ b/tests/gtests/blenlib/BLI_ghash_performance_test.cc
@@ -464,6 +464,113 @@ TEST(ghash, Int4Murmur2a20000000)
}
#endif
+/* GHash inthash_v2 tests */
+TEST(ghash, Int2NoHash12000)
+{
+ GHash *ghash = BLI_ghash_new(ghashutil_tests_nohash_p, ghashutil_tests_cmp_p, __func__);
+
+ randint_ghash_tests(ghash, "RandIntGHash - No Hash - 12000", 12000);
+}
+
+#ifdef GHASH_RUN_BIG
+TEST(ghash, Int2NoHash50000000)
+{
+ GHash *ghash = BLI_ghash_new(ghashutil_tests_nohash_p, ghashutil_tests_cmp_p, __func__);
+
+ randint_ghash_tests(ghash, "RandIntGHash - No Hash - 50000000", 50000000);
+}
+#endif
+
+/* Int_v2: 20M of randomly-generated integer vectors. */
+
+static void int2_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr)
+{
+ printf("\n========== STARTING %s ==========\n", id);
+
+ void *data_v = MEM_mallocN(sizeof(unsigned int[2]) * (size_t)nbr, __func__);
+ unsigned int(*data)[2] = (unsigned int(*)[2])data_v;
+ unsigned int(*dt)[2];
+ unsigned int i, j;
+
+ {
+ RNG *rng = BLI_rng_new(0);
+ for (i = nbr, dt = data; i--; dt++) {
+ for (j = 2; j--;) {
+ (*dt)[j] = BLI_rng_get_uint(rng);
+ }
+ }
+ BLI_rng_free(rng);
+ }
+
+ {
+ TIMEIT_START(int_v2_insert);
+
+#ifdef GHASH_RESERVE
+ BLI_ghash_reserve(ghash, nbr);
+#endif
+
+ for (i = nbr, dt = data; i--; dt++) {
+ BLI_ghash_insert(ghash, *dt, POINTER_FROM_UINT(i));
+ }
+
+ TIMEIT_END(int_v2_insert);
+ }
+
+ PRINTF_GHASH_STATS(ghash);
+
+ {
+ TIMEIT_START(int_v2_lookup);
+
+ for (i = nbr, dt = data; i--; dt++) {
+ void *v = BLI_ghash_lookup(ghash, (void *)(*dt));
+ EXPECT_EQ(POINTER_AS_UINT(v), i);
+ }
+
+ TIMEIT_END(int_v2_lookup);
+ }
+
+ BLI_ghash_free(ghash, NULL, NULL);
+ MEM_freeN(data);
+
+ printf("========== ENDED %s ==========\n\n", id);
+}
+
+TEST(ghash, Int2GHash2000)
+{
+ GHash *ghash = BLI_ghash_new(
+ BLI_ghashutil_uinthash_v2_p, BLI_ghashutil_uinthash_v2_cmp, __func__);
+
+ int2_ghash_tests(ghash, "Int2GHash - GHash - 2000", 2000);
+}
+
+#ifdef GHASH_RUN_BIG
+TEST(ghash, Int2GHash20000000)
+{
+ GHash *ghash = BLI_ghash_new(
+ BLI_ghashutil_uinthash_v2_p, BLI_ghashutil_uinthash_v2_cmp, __func__);
+
+ int2_ghash_tests(ghash, "Int2GHash - GHash - 20000000", 20000000);
+}
+#endif
+
+TEST(ghash, Int2Murmur2a2000)
+{
+ GHash *ghash = BLI_ghash_new(
+ BLI_ghashutil_uinthash_v2_p_murmur, BLI_ghashutil_uinthash_v2_cmp, __func__);
+
+ int2_ghash_tests(ghash, "Int2GHash - Murmur - 2000", 2000);
+}
+
+#ifdef GHASH_RUN_BIG
+TEST(ghash, Int2Murmur2a20000000)
+{
+ GHash *ghash = BLI_ghash_new(
+ BLI_ghashutil_uinthash_v2_p_murmur, BLI_ghashutil_uinthash_v2_cmp, __func__);
+
+ int2_ghash_tests(ghash, "Int2GHash - Murmur - 20000000", 20000000);
+}
+#endif
+
/* MultiSmall: create and manipulate a lot of very small ghashes
* (90% < 10 items, 9% < 100 items, 1% < 1000 items). */