lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
ctest_utils.hh File Reference

Declares small test helpers that print and modify arrays and vectors. More...

#include <unistd.h>
#include <vector>
#include <iostream>

Namespaces

namespace  psalg
 Usage.
 

Typedefs

typedef long int psalg::NPSHAPE_T
 long int; shape element type used by ctest_nda_v2().
 

Functions

template<typename T >
void psalg::ctest_nda (T *arr, int r, int c)
 Test helper: print r, c and the r*c elements of arr to stdout, adding each element's index to it (arr[i] = i + arr[i]).
 
void psalg::ctest_nda_f8 (double *arr, int r, int c)
 Call ctest_nda<double>(arr, r, c).
 
void psalg::ctest_nda_i2 (int16_t *arr, int r, int c)
 Call ctest_nda<int16_t>(arr, r, c).
 
void psalg::ctest_nda_u2 (uint16_t *arr, int r, int c)
 Call ctest_nda<uint16_t>(arr, r, c).
 
template<typename T >
void psalg::ctest_nda_v2 (T *arr, NPSHAPE_T *sh, int &ndim)
 Test helper: print ndim and the first ndim entries of sh, then print the first 10 elements of arr and add 1 to each of them (always 10, whatever the shape).
 
template<typename T >
void psalg::ctest_vector (vector< T > &v)
 Test helper: print the size of v, set v[2] to 222 (not range-checked), then print all elements of v to stdout.
 

Detailed Description

Declares small test helpers that print and modify arrays and vectors.