test_depofanout.cxx
Go to the documentation of this file.
3 #include "WireCellUtil/Testing.h"
7 
8 using namespace WireCell;
9 
10 int main()
11 {
13  pm.add("WireCellGen");
14 
15  const size_t multiplicity = 6;
16  const std::string df_tn = "DepoFanout";
17 
18  {
19  auto icfg = Factory::lookup<IConfigurable>(df_tn);
20  auto cfg = icfg->default_configuration();
21  cfg["multiplicity"] = (int)multiplicity;
22  icfg->configure(cfg);
23  }
24 
25  auto dfo = Factory::find_tn<IDepoFanout>(df_tn);
26 
27  Assert(dfo->output_types().size() == multiplicity);
28 
29  const int ident = 42;
30  auto realdepo = std::make_shared<SimpleDepo>(0, Point(0,0,0), 1.0, nullptr, 0, 0, ident);
31 
32  for (auto depo : IDepo::vector({realdepo, nullptr})) {
34  bool ok = (*dfo)(depo, outv);
35  Assert(ok); // should always be so
36  Assert(outv.size() == multiplicity);
37  for (auto d : outv) {
38  if (depo) {
39  Assert(d->id() == ident);
40  }
41  else {
42  Assert (d == nullptr);
43  }
44  }
45  }
46  return 0;
47 }
48 
D3Vector< double > Point
A 3D Cartesian point in double precision.
Definition: Point.h:15
std::string string
Definition: nybbler.cc:12
cfg
Definition: dbjson.py:29
std::vector< pointer > vector
Definition: IData.h:21
static PluginManager & instance()
#define Assert
Definition: Testing.h:7
std::vector< output_pointer > output_vector
Definition: IFanoutNode.h:45
Definition: Main.h:22
int main()
Plugin * add(const std::string &plugin_name, const std::string &libname="")
Add a plugin. If libname is not given, try to derive it.