2
0
mirror of https://github.com/boostorg/test.git synced 2026-01-27 07:22:11 +00:00
Files
test/doc/v2/examples/example60.cpp
Raffi Enficiaud 648835806e Working on the stl part
Apparently this is not working as expected. At least the macro BOOST_TEST_DONT_PRINT_LOG_VALUE is not respected during the instanciation of the dataset
2014-12-09 18:07:35 +01:00

48 lines
1001 B
C++

//[example_code
#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp>
#include <boost/test/data/test_case.hpp>
#include <boost/test/data/monomorphic.hpp>
#include <vector>
#include <map>
std::vector<int> generate_vector()
{
std::vector<int> out;
out.push_back(3);
out.push_back(1);
out.push_back(7);
return out;
}
typedef const std::pair<const int, int> pair_int;
BOOST_TEST_DONT_PRINT_LOG_VALUE( pair_int );
const std::vector<int> v = generate_vector();
BOOST_DATA_TEST_CASE( test_case_1, data::make(v), var1)
{
std::cout << var1 << std::endl;
BOOST_CHECK(true);
}
std::map<int, int> generate_map()
{
std::vector<int> v = generate_vector();
std::map<int, int> out;
for(std::size_t i = 0; i < v.size(); i++)
{
out[v[i]] = (i * 7) % 19;
}
return out;
}
const std::map<int, int> m = generate_map();
BOOST_DATA_TEST_CASE( test_case_2, data::make(m), var1)
{
std::cout << var1->first << " -- " << var1->second << std::endl;
BOOST_CHECK(true);
}
//]