PhoenixDataStream  1.0.0
Framework to save/load/serialize/deserialize data
Loading...
Searching...
No Matches
data_stream_check_value.h File Reference
#include <string>
#include <vector>
#include <list>
#include <map>
#include <iostream>
#include <sstream>
#include "data_stream_check_value_impl.h"
+ Include dependency graph for data_stream_check_value.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename T, typename U>
bool checkValue (const std::string &testName, const std::list< std::pair< T, U > > &vecData, const std::list< std::pair< T, U > > &vecReferenceData)
 Check given value compare to the reference size.
 
template<typename T>
bool checkValue (const std::string &testName, const std::list< T > &vecData, const std::list< T > &vecReferenceData)
 Check given value compare to the reference size.
 
template<typename T, typename U>
bool checkValue (const std::string &testName, const std::map< T, U > &vecData, const std::map< T, U > &vecReferenceData)
 Check given value compare to the reference size.
 
template<typename T, typename U>
bool checkValue (const std::string &testName, const std::vector< std::pair< T, U > > &vecData, const std::vector< std::pair< T, U > > &vecReferenceData)
 Check given value compare to the reference size.
 
template<typename T>
bool checkValue (const std::string &testName, const std::vector< T > &vecData, const std::vector< T > &vecReferenceData)
 Check given value compare to the reference size.
 
template<typename T>
bool checkValue (const std::string &testName, const T &givenSize, const T &referenceSize)
 Check given value compare to the reference value.
 
template<typename T>
bool checkValue (const std::string &testName, const T *tabData, const T *tabReferenceData, size_t nbElement)
 Check given value compare to the reference value.
 

Function Documentation

◆ checkValue() [1/7]

template<typename T, typename U>
bool checkValue ( const std::string & testName,
const std::list< std::pair< T, U > > & vecData,
const std::list< std::pair< T, U > > & vecReferenceData )

Check given value compare to the reference size.

Parameters
testName: name of the current test
vecData: vector of data to be checked
vecReferenceData: vector of reference data
Returns
true on success, false otherwise

Definition at line 162 of file data_stream_check_value_impl.h.

162 {
163 if(vecData.size() != vecReferenceData.size()){
164 std::cout << "checkValue : "<<testName<<" => vecData.size(" << vecData.size() << ") != vecReferenceData.size("<<vecReferenceData.size()<<")" << std::endl;
165 return false;
166 }
167 bool b(true);
168 typename std::list<std::pair<T,U> >::const_iterator itData = vecData.begin();
169 typename std::list<std::pair<T,U> >::const_iterator itRef = vecReferenceData.begin();
170 size_t i(0lu);
171 while(itData != vecData.end() && itRef != vecReferenceData.end()){
172 b &= itData->first == itRef->first;
173 b &= itData->second == itRef->second;
174 if(!b){
175 std::cout << "checkValue : "<<testName<<" => vecData["<<i<<"](" << itData->first << ", " << itData->second << ") != vecReferenceData["<<i<<"]("<<itRef->first << ","<<itRef->second <<")" << std::endl;
176 }
177 ++i;
178 ++itData;
179 ++itRef;
180 }
181// if(b){std::cout << "checkValue : "<<testName<<" => Ok"<<std::endl;}
182// else{std::cout << "checkValue : "<<testName<<" => WRONG!!!!"<<std::endl;}
183 return b;
184}

◆ checkValue() [2/7]

template<typename T>
bool checkValue ( const std::string & testName,
const std::list< T > & vecData,
const std::list< T > & vecReferenceData )

Check given value compare to the reference size.

Parameters
testName: name of the current test
vecData: vector of data to be checked
vecReferenceData: vector of reference data
Returns
true on success, false otherwise

Definition at line 76 of file data_stream_check_value_impl.h.

76 {
77 if(vecData.size() != vecReferenceData.size()){
78 std::cout << "checkValue : "<<testName<<" => vecData.size(" << vecData.size() << ") != vecReferenceData.size("<<vecReferenceData.size()<<")" << std::endl;
79 return false;
80 }
81 bool b(true);
82 typename std::list<T>::const_iterator itData = vecData.begin();
83 typename std::list<T>::const_iterator itRef = vecReferenceData.begin();
84 size_t i(0lu);
85 while(itData != vecData.end() && itRef != vecReferenceData.end()){
86 b &= *itData == *itRef;
87 if(!b){
88 std::cout << "checkValue : "<<testName<<" => vecData["<<i<<"](" << (*itData) << ") != vecReferenceData["<<i<<"]("<<(*itRef)<<")" << std::endl;
89 }
90 ++i;
91 ++itData;
92 ++itRef;
93 }
94// if(b){std::cout << "checkValue : "<<testName<<" => Ok"<<std::endl;}
95// else{std::cout << "checkValue : "<<testName<<" => WRONG!!!!"<<std::endl;}
96 return b;
97}

◆ checkValue() [3/7]

template<typename T, typename U>
bool checkValue ( const std::string & testName,
const std::map< T, U > & vecData,
const std::map< T, U > & vecReferenceData )

Check given value compare to the reference size.

Parameters
testName: name of the current test
vecData: vector of data to be checked
vecReferenceData: vector of reference data
Returns
true on success, false otherwise

Definition at line 106 of file data_stream_check_value_impl.h.

106 {
107 if(vecData.size() != vecReferenceData.size()){
108 std::cout << "checkValue : "<<testName<<" => vecData.size(" << vecData.size() << ") != vecReferenceData.size("<<vecReferenceData.size()<<")" << std::endl;
109 return false;
110 }
111 bool b(true);
112 typename std::map<T,U>::const_iterator itData = vecData.begin();
113 typename std::map<T, U>::const_iterator itRef = vecReferenceData.begin();
114 size_t i(0lu);
115 while(itData != vecData.end() && itRef != vecReferenceData.end()){
116 b &= itData->first == itRef->first;
117 b &= itData->second == itRef->second;
118 if(!b){
119 std::cout << "checkValue : "<<testName<<" => vecData["<<i<<"](" << itData->first << ", " << itData->second << ") != vecReferenceData["<<i<<"]("<<itRef->first << "," << itRef->second<<")" << std::endl;
120 }
121 ++i;
122 ++itData;
123 ++itRef;
124 }
125// if(b){std::cout << "checkValue : "<<testName<<" => Ok"<<std::endl;}
126// else{std::cout << "checkValue : "<<testName<<" => WRONG!!!!"<<std::endl;}
127 return b;
128}

◆ checkValue() [4/7]

template<typename T, typename U>
bool checkValue ( const std::string & testName,
const std::vector< std::pair< T, U > > & vecData,
const std::vector< std::pair< T, U > > & vecReferenceData )

Check given value compare to the reference size.

Parameters
testName: name of the current test
vecData: vector of data to be checked
vecReferenceData: vector of reference data
Returns
true on success, false otherwise

Definition at line 137 of file data_stream_check_value_impl.h.

137 {
138 if(vecData.size() != vecReferenceData.size()){
139 std::cout << "checkValue : "<<testName<<" => vecData.size(" << vecData.size() << ") != vecReferenceData.size("<<vecReferenceData.size()<<")" << std::endl;
140 return false;
141 }
142 bool b(true);
143 for(size_t i(0lu); i < vecData.size() && b; ++i){
144 b &= vecData[i].first == vecReferenceData[i].first;
145 b &= vecData[i].second == vecReferenceData[i].second;
146 if(!b){
147 std::cout << "checkValue : "<<testName<<" => vecData["<<i<<"](" << vecData[i].first << ", " << vecData[i].second << ") != vecReferenceData["<<i<<"]("<<vecReferenceData[i].first << ","<<vecReferenceData[i].second <<")" << std::endl;
148 }
149 }
150// if(b){std::cout << "checkValue : "<<testName<<" => Ok"<<std::endl;}
151// else{std::cout << "checkValue : "<<testName<<" => WRONG!!!!"<<std::endl;}
152 return b;
153}

◆ checkValue() [5/7]

template<typename T>
bool checkValue ( const std::string & testName,
const std::vector< T > & vecData,
const std::vector< T > & vecReferenceData )

Check given value compare to the reference size.

Parameters
testName: name of the current test
vecData: vector of data to be checked
vecReferenceData: vector of reference data
Returns
true on success, false otherwise

Definition at line 52 of file data_stream_check_value_impl.h.

52 {
53 if(vecData.size() != vecReferenceData.size()){
54 std::cout << "checkValue : "<<testName<<" => vecData.size(" << vecData.size() << ") != vecReferenceData.size("<<vecReferenceData.size()<<")" << std::endl;
55 return false;
56 }
57 bool b(true);
58 for(size_t i(0lu); i < vecData.size() && b; ++i){
59 b &= vecData[i] == vecReferenceData[i];
60 if(!b){
61 std::cout << "checkValue : "<<testName<<" => vecData["<<i<<"](" << vecData[i] << ") != vecReferenceData["<<i<<"]("<<vecReferenceData[i]<<")" << std::endl;
62 }
63 }
64// if(b){std::cout << "checkValue : "<<testName<<" => Ok"<<std::endl;}
65// else{std::cout << "checkValue : "<<testName<<" => WRONG!!!!"<<std::endl;}
66 return b;
67}

◆ checkValue() [6/7]

template<typename T>
bool checkValue ( const std::string & testName,
const T & givenSize,
const T & referenceSize )

Check given value compare to the reference value.

Parameters
testName: name of the current test
givenSize: size to be tested
referenceSize: reference value
Returns
true on success, false otherwise

Definition at line 19 of file data_stream_check_value_impl.h.

19 {
20// std::cout << "checkValue : "<<testName<<" => " << givenSize << ", reference ("<<referenceSize<<")" << std::endl;
21 if(givenSize != referenceSize){
22 std::cerr << "checkValue : "<<testName<<" wrong size givenSize("<<givenSize<<") != referenceSize("<<referenceSize<<")" << std::endl;
23 }
24 return givenSize == referenceSize;
25}

Referenced by checkValue().

+ Here is the caller graph for this function:

◆ checkValue() [7/7]

template<typename T>
bool checkValue ( const std::string & testName,
const T * tabData,
const T * tabReferenceData,
size_t nbElement )

Check given value compare to the reference value.

Parameters
testName: name of the current test
tabData: table of values to be tested
tabReferenceData: table of reference value
nbElement: number of elements to be checked
Returns
true on success, false otherwise

Definition at line 35 of file data_stream_check_value_impl.h.

35 {
36 bool b(true);
37 for(size_t i(0lu); i < nbElement && b; ++i){
38 std::stringstream str;
39 str << i;
40 b &= checkValue(testName + " element "+str.str(), tabData[i], tabReferenceData[i]);
41 }
42 return b;
43}
bool checkValue(const std::string &testName, const T &givenSize, const T &referenceSize)
Check given value compare to the reference value.

References checkValue().

+ Here is the call graph for this function: