#include "WireCellUtil/Testing.h"
#include <vector>
#include <set>
#include <deque>
#include <iterator>
#include <algorithm>
#include <iostream>
#include <memory>
#include <random>
Go to the source code of this file.
Definition at line 18 of file test_set.cxx.
21 vector<int> items = {0,1,2,3,4,5,6,7,8,9};
22 set<int> die = {2,4,5,42};
26 set_difference(items.begin(), items.end(),
27 die.begin(), die.end(),
28 back_inserter(result));
30 for (
auto item : items) {
35 for (
auto alive: result) {
41 set_difference(items.begin(), items.end(),
42 die2.begin(), die2.end(),
43 back_inserter(result2));
45 Assert(items.size() == 10);
47 Assert(result.size() == 7);
50 Assert(result2.size() == 10);
53 std::random_device rd;
54 std::default_random_engine re(rd());
55 std::uniform_real_distribution<> dist(0, 1000);
57 typedef std::shared_ptr<int> Pint;
59 const int nitems = 1000;
60 for (
int ind=0; ind<nitems; ++ind) {
61 queue.push_back(Pint(
new int(dist(re))));
63 for (
int ind=0; ind<nitems; ++ind) {
64 Pint front = queue.front();
66 cerr << ind <<
": popped:" << *front
67 <<
" now with: " << queue.size() <<
" items"
QTextStream & endl(QTextStream &s)