Functions
test_depofanout.cxx File Reference
#include "WireCellUtil/PluginManager.h"
#include "WireCellUtil/NamedFactory.h"
#include "WireCellUtil/Testing.h"
#include "WireCellIface/IDepoFanout.h"
#include "WireCellIface/IConfigurable.h"
#include "WireCellIface/SimpleDepo.h"

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

int main ( void  )

Definition at line 10 of file test_depofanout.cxx.

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})) {
33  IDepoFanout::output_vector outv;
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 }
std::string string
Definition: nybbler.cc:12
struct vector vector
const std::string instance
cfg
Definition: dbjson.py:29
#define Assert
Definition: Testing.h:7
std::tuple< double, double, const reco::ClusterHit3D * > Point
Definitions used by the VoronoiDiagram algorithm.
Definition: DCEL.h:34
Plugin * add(const std::string &plugin_name, const std::string &libname="")
Add a plugin. If libname is not given, try to derive it.