diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 10:48:22 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-01-29 10:48:22 +0000 |
commit | c3fdbed0e06c6096cb4ac3222201a6b6d81fe0ee (patch) | |
tree | 88747e5c0c99b4d6545122d8c4f432d61651c34e /lib/mesa/src/util/tests/set | |
parent | 27f1603bcb35dc0629966529c5b85cd8936ea1c8 (diff) |
Import Mesa 18.3.2
Diffstat (limited to 'lib/mesa/src/util/tests/set')
-rw-r--r-- | lib/mesa/src/util/tests/set/meson.build | 8 | ||||
-rw-r--r-- | lib/mesa/src/util/tests/set/set_test.cpp | 58 |
2 files changed, 4 insertions, 62 deletions
diff --git a/lib/mesa/src/util/tests/set/meson.build b/lib/mesa/src/util/tests/set/meson.build index e9b00629b..add3fc560 100644 --- a/lib/mesa/src/util/tests/set/meson.build +++ b/lib/mesa/src/util/tests/set/meson.build @@ -23,8 +23,8 @@ test( executable( 'set_test', 'set_test.cpp', - dependencies : [dep_thread, dep_dl, idep_gtest, idep_mesautil], - include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux], - ), - suite : ['util'], + dependencies : [dep_thread, dep_dl, idep_gtest], + include_directories : inc_common, + link_with : [libmesa_util], + ) ) diff --git a/lib/mesa/src/util/tests/set/set_test.cpp b/lib/mesa/src/util/tests/set/set_test.cpp index 67e3085ee..a1eef0b3d 100644 --- a/lib/mesa/src/util/tests/set/set_test.cpp +++ b/lib/mesa/src/util/tests/set/set_test.cpp @@ -51,27 +51,6 @@ TEST(set, basic) entry = _mesa_set_search(s, a); EXPECT_FALSE(entry); - _mesa_set_clear(s, NULL); - EXPECT_EQ(s->entries, 0); - EXPECT_EQ(s->deleted_entries, 0); - set_foreach(s, he) { - GTEST_FAIL(); - } - - _mesa_set_add(s, a); - _mesa_set_add(s, b); - EXPECT_EQ(s->entries, 2); - unsigned count = s->entries; - set_foreach_remove(s, he) { - EXPECT_TRUE(he->key == a || he->key == b); - EXPECT_EQ(s->entries, count--); - EXPECT_EQ(s->deleted_entries, 0); - } - EXPECT_EQ(s->entries, 0); - set_foreach(s, he) { - GTEST_FAIL(); - } - _mesa_set_destroy(s, NULL); } @@ -134,40 +113,3 @@ TEST(set, remove_key) _mesa_set_destroy(s, NULL); } - -static uint32_t hash_int(const void *p) -{ - int i = *(const int *)p; - return i; -} - -static bool cmp_int(const void *p1, const void *p2) -{ - int i1 = *(const int *)p1, i2 = *(const int *)p2; - return i1 == i2; -} - -TEST(set, search_or_add) -{ - struct set *s = _mesa_set_create(NULL, hash_int, cmp_int); - - int a = 10, b = 20, c = 20, d = 30; - - _mesa_set_add(s, &a); - _mesa_set_add(s, &b); - EXPECT_EQ(s->entries, 2); - - bool found = false; - struct set_entry *entry = _mesa_set_search_or_add(s, &c, &found); - EXPECT_EQ(entry->key, (void *)&b); - EXPECT_EQ(found, true); - EXPECT_EQ(s->entries, 2); - - found = false; - struct set_entry *entry3 = _mesa_set_search_or_add(s, &d, &found); - EXPECT_EQ(entry3->key, &d); - EXPECT_EQ(found, false); - EXPECT_EQ(s->entries, 3); - - _mesa_set_destroy(s, NULL); -} |