-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
The example code in README.md aims to test the += operator of safe_umx, but because it adds 42 to 0, it would also pass if the operator was (incorrectly) implemented as an assignment instead of an addition (as zero is the identity element of addition).
The fix would be to initialize data2 to a non-zero value.
Lines 139 to 144 in 6509cff
| constexpr auto data1{42_umx}; | |
| bsl::safe_umx data2{}; | |
| bsl::ut_when{} = [&]() noexcept { | |
| data2 += data1; | |
| bsl::ut_then{} = [&]() noexcept { | |
| bsl::ut_check(data2.checked() == data1); |
alecco
Metadata
Metadata
Assignees
Labels
No labels