Blender Git Commit Log

Git Commits -> Revision 72a199e

Revision 72a199e by Sergey Sharybin (master)
November 19, 2020, 16:19 (GMT)
Atomic: Cover with unit tests

Cover all atomic functions with unit tests.

The tests are quite simple, nothing special so far. The goal is to:

- Make sure implementation exists.
- Implementation behaves the same way on all platforms
(We had issue when MSVC and GCC were behaving differently in the
past).
- Proper bitness is used for implementation and non-fixed-size
function implementation.

The tests can be extended further to make sure, for example, that
CAS operations do not cast arguments to a more narrow type for
comparison. Considering it a possible further improvement, as it is
better be done being focused on that specific task.

There is an annoying ifdef around 64bit implementation, which uses
same internal ifdef as the header does. This check is aimed to be
removed, so is easier to simply accept such duplication for now.

The tests seems somewhat duplicate for signed/unsigned variants and
things like this. The reason for that is to keep test code as simple
as possible: attempting to do something smart/tricky in the test code
often causes the test code to be a subject of being covered with its
own unit tests.

Differential Revision: https://developer.blender.org/D9590

Commit Details:

Full Hash: 72a199e148b20c36a63cdf6c6af067c9bcdb3f92
Parent Commit: 0d027b4
Lines Changed: +922, -0

2 Added Paths:

/intern/atomic/CMakeLists.txt (+38, -0) (View)
/intern/atomic/tests/atomic_test.cc (+883, -0) (View)

1 Modified Path:

/intern/CMakeLists.txt (+1, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021