q_collapsed_metrics_test.h
Go to the documentation of this file.
1 
9 #pragma once
12 #include "interop/util/length_of.h"
13 
14 
15 namespace illumina{ namespace interop { namespace unittest
16 {
17 
22  template<int Version>
23  struct q_collapsed_metric_v_2_4 : metric_test<model::metrics::q_collapsed_metric, Version>
24  {
30  typedef typename parent_t::metric_t metric_t;
35  static void create_expected(metric_set_t& metrics, const model::run::info& =model::run::info())
36  {
38  metrics.insert(metric_t(1,1105,1,2447414,2334829,2566750,33));
39  metrics.insert(metric_t(1,1103,1,2436317,2327796,2543605,33));
40  metrics.insert(metric_t(1,1106,1,2474217,2366046,2583629,33));
41  }
46  template<class Collection>
47  static void create_binary_data(Collection& buffer)
48  {
49  const signed char tmp[] =
50  {
51  Version,22
52  ,1,0,81,4,1,0,54,88,37,0,109,-96,35,0,94,42,39,0,0,0,4,66
53  ,1,0,79,4,1,0,-35,44,37,0,-12,-124,35,0,-11,-49,38,0,0,0,4,66
54  ,1,0,82,4,1,0,-23,-64,37,0,94,26,36,0,77,108,39,0,0,0,4,66
55  };
56  buffer.assign(tmp, tmp+util::length_of(tmp));
57  }
58  };
77 
78 
84  template<int Version>
85  struct q_collapsed_metric_v5_6 : metric_test<model::metrics::q_collapsed_metric, Version>
86  {
92  typedef typename parent_t::metric_t metric_t;
93  enum{
95  disable_binary_data=true, // work around for dropping header
97  disable_binary_data_size=true // work around for dropping header
98  };
103  static void create_expected(metric_set_t& metrics, const model::run::info& =model::run::info())
104  {
105  typedef typename metric_set_t::header_type header_t;
106  typedef typename header_t::qscore_bin_vector_type qscore_bin_vector_type;
107  typedef typename header_t::bin_t bin_t;
108  typedef typename bin_t::bin_type ushort_t;
109  typedef typename metric_t::uint_t uint_t;
110  const uint_t bin_count = 7;
111 
112  const ushort_t lower[] = {2, 10, 20, 25, 30, 35, 40};
113  const ushort_t upper[] = {9, 19, 24, 29, 34, 39, 40};
114  const ushort_t value[] = {2, 14, 21, 27, 32, 36, 40};
115  qscore_bin_vector_type headervec;
116  for(uint_t i=0;i<bin_count;i++)
117  headervec.push_back(bin_t(lower[i], upper[i], value[i]));
118 
119  metrics = metric_set_t(header_t(headervec), parent_t::VERSION);
120  metrics.insert(metric_t(1,1105,1,2447414,2334829,2566750,33));
121  metrics.insert(metric_t(1,1103,1,2436317,2327796,2543605,33));
122  metrics.insert(metric_t(1,1106,1,2474217,2366046,2583629,33));
123  }
128  template<class Collection>
129  static void create_binary_data(Collection& buffer)
130  {
131  const signed char tmp[] =
132  {
133  Version,22,1,7,2,10,20,25,30,35,40,9,19,24,29,34,39,40,2,14,21,27,32,36,40
134  ,1,0,81,4,1,0,54,88,37,0,109,-96,35,0,94,42,39,0,0,0,4,66
135  ,1,0,79,4,1,0,-35,44,37,0,-12,-124,35,0,-11,-49,38,0,0,0,4,66
136  ,1,0,82,4,1,0,-23,-64,37,0,94,26,36,0,77,108,39,0,0,0,4,66
137  };
138  buffer.assign(tmp, tmp+util::length_of(tmp));
139  }
140  };
153 
158  template<int Version>
159  struct q_collapsed_metric_no_median_v_2_4 : metric_test<model::metrics::q_collapsed_metric, Version, 'b'>
160  {
161  enum{
166  };
172  typedef typename parent_t::metric_t metric_t;
177  static void create_expected(metric_set_t& metrics, const model::run::info& =model::run::info())
178  {
179  metrics = metric_set_t(parent_t::VERSION);
180  metrics.insert(metric_t(1,1105,1,2447414,2334829,2566750,0));
181  metrics.insert(metric_t(1,1103,1,2436317,2327796,2543605,0));
182  metrics.insert(metric_t(1,1106,1,2474217,2366046,2583629,0));
183  }
188  template<class Collection>
189  static void create_binary_data(Collection& buffer)
190  {
191  const signed char tmp[] =
192  {
193  Version,18
194  ,1,0,81,4,1,0,54,88,37,0,109,-96,35,0,94,42,39,0
195  ,1,0,79,4,1,0,-35,44,37,0,-12,-124,35,0,-11,-49,38,0
196  ,1,0,82,4,1,0,-23,-64,37,0,94,26,36,0,77,108,39,0
197  };
198  buffer.assign(tmp, tmp+util::length_of(tmp));
199  }
200  };
219 
220 
226  template<int Version>
227  struct q_collapsed_metric_no_median_v5_6 : metric_test<model::metrics::q_collapsed_metric, Version, 'b'>
228  {
234  typedef typename parent_t::metric_t metric_t;
235  enum{
240  };
245  static void create_expected(metric_set_t& metrics, const model::run::info& =model::run::info())
246  {
247  typedef typename metric_set_t::header_type header_t;
248  typedef typename header_t::qscore_bin_vector_type qscore_bin_vector_type;
249  typedef typename header_t::bin_t bin_t;
250  typedef typename bin_t::bin_type ushort_t;
251  typedef typename metric_t::uint_t uint_t;
252  const uint_t bin_count = 7;
253 
254  const ushort_t lower[] = {2, 10, 20, 25, 30, 35, 40};
255  const ushort_t upper[] = {9, 19, 24, 29, 34, 39, 40};
256  const ushort_t value[] = {2, 14, 21, 27, 32, 36, 40};
257  qscore_bin_vector_type headervec;
258  for(uint_t i=0;i<bin_count;i++)
259  headervec.push_back(bin_t(lower[i], upper[i], value[i]));
260 
261  metrics = metric_set_t(header_t(headervec), parent_t::VERSION);
262  metrics.insert(metric_t(1,1105,1,2447414,2334829,2566750,0));
263  metrics.insert(metric_t(1,1103,1,2436317,2327796,2543605,0));
264  metrics.insert(metric_t(1,1106,1,2474217,2366046,2583629,0));
265  }
270  template<class Collection>
271  static void create_binary_data(Collection& buffer)
272  {
273  const signed char tmp[] =
274  {
275  Version,18,1,7,2,10,20,25,30,35,40,9,19,24,29,34,39,40,2,14,21,27,32,36,40
276  ,1,0,81,4,1,0,54,88,37,0,109,-96,35,0,94,42,39,0
277  ,1,0,79,4,1,0,-35,44,37,0,-12,-124,35,0,-11,-49,38,0
278  ,1,0,82,4,1,0,-23,-64,37,0,94,26,36,0,77,108,39,0
279  };
280  buffer.assign(tmp, tmp+util::length_of(tmp));
281  }
282  };
295 
296 }}}
297 
void insert(const metric_type &metric)
Definition: metric_set.h:267
static void create_binary_data(Collection &buffer)
Definition: q_collapsed_metrics_test.h:47
parent_t::metric_t metric_t
Definition: q_collapsed_metrics_test.h:92
Definition: enum_description.h:15
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_collapsed_metrics_test.h:35
Definition: q_collapsed_metrics_test.h:152
T::header_type header_type
Definition: metric_set.h:47
Definition: q_collapsed_metrics_test.h:212
parent_t::metric_set_t metric_set_t
Definition: q_collapsed_metrics_test.h:28
parent_t::metric_set_t metric_set_t
Definition: q_collapsed_metrics_test.h:90
static void create_binary_data(Collection &buffer)
Definition: q_collapsed_metrics_test.h:189
parent_t::metric_t metric_t
Definition: q_collapsed_metrics_test.h:234
parent_t::metric_set_t metric_set_t
Definition: q_collapsed_metrics_test.h:170
Definition: metric_test.h:41
Definition: q_collapsed_metrics_test.h:227
Definition: q_collapsed_metrics_test.h:218
Definition: q_collapsed_metrics_test.h:159
static void create_binary_data(Collection &buffer)
Definition: q_collapsed_metrics_test.h:271
metric_test< model::metrics::q_collapsed_metric, Version > parent_t
Definition: q_collapsed_metrics_test.h:88
::uint32_t uint_t
Definition: base_metric.h:77
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_collapsed_metrics_test.h:245
Definition: q_collapsed_metrics_test.h:70
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_collapsed_metrics_test.h:103
parent_t::metric_t metric_t
Definition: q_collapsed_metrics_test.h:30
Definition: q_collapsed_metrics_test.h:64
static void create_expected(metric_set_t &metrics, const model::run::info &=model::run::info())
Definition: q_collapsed_metrics_test.h:177
Definition: q_collapsed_metrics_test.h:288
std::vector< q_score_bin > qscore_bin_vector_type
Definition: q_metric.h:114
metric_test< model::metrics::q_collapsed_metric, Version > parent_t
Definition: q_collapsed_metrics_test.h:26
Definition: q_collapsed_metrics_test.h:76
Definition: q_collapsed_metrics_test.h:85
metric_test< model::metrics::q_collapsed_metric, Version > parent_t
Definition: q_collapsed_metrics_test.h:230
static void create_binary_data(Collection &buffer)
Definition: q_collapsed_metrics_test.h:129
Definition: q_collapsed_metrics_test.h:23
Definition: q_collapsed_metrics_test.h:294
size_t length_of(const T &val)
Definition: length_of.h:55
metric_test< model::metrics::q_collapsed_metric, Version > parent_t
Definition: q_collapsed_metrics_test.h:168
Definition: q_collapsed_metrics_test.h:146
parent_t::metric_t metric_t
Definition: q_collapsed_metrics_test.h:172
Definition: q_collapsed_metrics_test.h:206
parent_t::metric_set_t metric_set_t
Definition: q_collapsed_metrics_test.h:232