ut
ut copied to clipboard
The main 'welcome' example seems out of date?
Expected Behavior
Exactly as shown in the image - type in the code as pictured and get
Running "sum"...
test.cpp:11:FAILED [(3 > 0 and 41 == 42)]
FAILED
Actual Behavior
Warnings on compilation
test.cpp:9:15: warning: ignoring return value of ‘constexpr auto boost::ext::ut::v1_1_8::operators::operator==,
... declared with attribute ‘nodiscard’ [-Wunused-result]
9 | sum(0) == 0_i;
| ^~~
Passes on run:
$ ./a.out
All tests passed (0 asserts in 1 tests)
Steps to Reproduce the Problem
As above.
Solved by adding expect to all lines:
expect(sum(0) == 0_i);
expect(sum(1,2) == 3_i);
expect(sum(1,2) > 0_i and 41_i == sum(40,2));
Specifications
- Version: 1'1'8
- Platform: Linux 5.13.4-200.fc34.x86_64 #1 SMP Tue Jul 20 20:27:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem:
Adding using namespace boost::ut::operators::terse;
doesn't fix the Expected Behavior, but gives a compile error:
$ g++ -I. -std=c++20 test.cpp
test.cpp: In lambda function:
test.cpp:13:27: error: ambiguous overload for ‘operator&&’ (operand types are ‘boost::ext::ut::v1_1_8::detail::gt_<int, boost::ext::ut::v1_1_8::detail::integral_constant<0> >’ and ‘boost::ext::ut::v1_1_8::detail::eq_<boost::ext::ut::v1_1_8::detail::integral_constant<41>, int>’)
13 | expect(sum(1,2) > 0_i and 41_i == sum(40,2));
| ~~~~~~~~~~~~~~ ^~~ ~~~~~~~~~~~~~~~~~
| | |
| | boost::ext::ut::v1_1_8::detail::eq_<boost::ext::ut::v1_1_8::detail::integral_constant<41>, int>
| boost::ext::ut::v1_1_8::detail::gt_<int, boost::ext::ut::v1_1_8::detail::integral_constant<0> >
test.cpp:13:27: note: candidate: ‘operator&&(bool, bool)’ (built-in)