| 8 | #include <boost/ut.hpp> |
| 9 | |
| 10 | int main() { |
| 11 | using namespace boost::ut; |
| 12 | |
| 13 | auto i = 0; // mutable |
| 14 | |
| 15 | "mut"_test = [i] { |
| 16 | expect((i == 0_i) >> fatal); // immutable |
| 17 | |
| 18 | should("++") = [i] { |
| 19 | expect(++mut(i) == 1_i); // mutable |
| 20 | expect(i == 1_i); // immutable |
| 21 | }; |
| 22 | |
| 23 | should("--") = [i] { |
| 24 | expect(--mut(i) == -1_i); // mutable |
| 25 | expect(i == -1_i); // immutable |
| 26 | }; |
| 27 | }; |
| 28 | } |