Closed kwarehit closed 1 year ago
I found root cause is that calling of boost::unit_test::data::make_delayed
dose not set value to m_dataset which is inside member of class boost::unit_test::data::monomorphic::delayed_dataset
, so the workflow will not do generate test_unit
, the key code snippet is there:
template<typename DataSet, typename Action>
inline typename std::enable_if<monomorphic::is_dataset<DataSet>::value,void>::type
for_each_sample( DataSet const & samples,
Action const& act,
data::size_t number_of_samples = BOOST_TEST_DS_INFINITE_SIZE )
{
data::size_t size = (std::min)( samples.size(), number_of_samples );
.....
}
in above code snippet, the variable size
is 0
, so there is no test case to be run
I think member function file_dataset::size()
on example should be call in above parameter samples
Final, the reason is content in the test_file.txt, because these are absence of new character '\n', if add a new line, the case will be run.
10.2 30.4
10.3 30.2
15.987984 15.9992
15.997984 15.9962
<= this is a new line
I think the error prompt of boost.test should be more details but not generic message "Test setup error: test tree is empty", Is this room for improvement?
Thanks for this investigation!
hi all, The following code was copied from https://www.boost.org/doc/libs/1_80_0/libs/test/doc/html/boost_test/runtime_config/custom_command_line_arguments.html, but output results is "test tree is empty" when run it by used command line "--log_level=all -- --test-file test_file.txt":
Test setup error: test tree is empty
The contents of test_file.txt:code is here:
Compiler is: vs2022.17.3 which default C++ standard is 14, boost version is 1.80 Looking forward to your reply, thanks