diff options
author | Julian Eisel <julian@blender.org> | 2022-07-29 00:50:40 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-07-29 00:53:33 +0300 |
commit | a9c74a0cd0dfea7d97bbca5e490a5dafdbae3b41 (patch) | |
tree | 86984f52d64d9ba162445840f01c9fe4ad276c50 /source/blender/blenlib | |
parent | 3d91a853b209bc82296e40a65c2cb816e618ec70 (diff) |
Fix set iterator test failure on macOS
This is a quite interesting case, where two arguments to a function are
evaluated in different order on Apple Clang than on GCC and I guess
MSVC. Left a comment on that.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/tests/BLI_set_test.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/blenlib/tests/BLI_set_test.cc b/source/blender/blenlib/tests/BLI_set_test.cc index 42a0d229b77..9dfa48b5822 100644 --- a/source/blender/blenlib/tests/BLI_set_test.cc +++ b/source/blender/blenlib/tests/BLI_set_test.cc @@ -532,8 +532,14 @@ TEST(set, ForwardIterator) Set<int>::iterator iter1 = set.begin(); int value1 = *iter1; Set<int>::iterator iter2 = iter1++; - EXPECT_EQ(*iter1, *(++iter1)); EXPECT_EQ(*iter2, value1); + EXPECT_EQ(*(++iter2), *iter1); + /* Interesting find: On GCC & MSVC this will succeed, as the 2nd argument is evaluated before the + * 1st. On Apple Clang it's the other way around, and the test fails. */ + // EXPECT_EQ(*iter1, *(++iter1)); + Set<int>::iterator iter3 = ++iter1; + /* Check that #iter1 itself changed. */ + EXPECT_EQ(*iter3, *iter1); } TEST(set, GenericAlgorithms) |