39 if (
os_) *
os_ <<
"diff_string(\"" << a <<
"\", \"" << b <<
"\")" << endl;
43 if (
os_) *
os_ <<
"a-b: " << a_b <<
"\nb-a: " << b_a << endl;
51template <
typename integral_type>
54 if (
os_) *
os_ <<
"diff_integral(\"" << a <<
"\", \"" << b <<
"\")" << endl;
56 integral_type a_b, b_a;
59 unit_assert(a_b == integral_type() && b_a == integral_type());
61 unit_assert(a_b != integral_type() || b_a != integral_type());
64template <
typename integral_type>
67 testIntegralReally<int>(1, 1);
68 testIntegralReally<int>(-1, 1);
69 testIntegralReally<int>(-1, -1);
70 testIntegralReally<int>(1, 0);
71 testIntegralReally<int>(-1, 0);
74template <
typename floating_type>
75void testFloating(floating_type a, floating_type b, floating_type precision)
77 floating_type a_b, b_a;
81 if (fabs(a - b) <= config.
precision + std::numeric_limits<floating_type>::epsilon())
82 unit_assert(a_b == floating_type() && b_a == floating_type());
84 unit_assert(a_b == fabs(a - b) && b_a == fabs(a - b));
90 if (
os_) *
os_ <<
"testCV()\n";
121 if (
os_) *
os_ <<
"testUserParam()\n";
135 b.
value =
"value_changed";
151 if (
os_) *
os_ <<
"testCVParam()\n";
163 b.
value =
"value_changed";
188 c.
value =
"410000.0";
205 if (
os_) *
os_ <<
"testParamContainer()\n";
252 if (
os_) *
os_ <<
"testParamGroup()\n";
255 a.userParams.push_back(
UserParam(
"common"));
261 a.userParams.push_back(
UserParam(
"different",
"1"));
281 testIntegral<short>();
282 testIntegral<long>();
283 testIntegral<unsigned int>();
284 testIntegral<unsigned short>();
285 testIntegral<unsigned long>();
287 testFloating<float>(1.f, 1.f, 1.e-6f);
288 testFloating<float>(1.f, 1.0000000001f, 1.e-6f);
289 testFloating<float>(1.f, 1.00001f, 1.e-6f);
290 testFloating<float>(4.f, 4.2f, 1.f);
292 testFloating<double>(1, 1, 1e-6);
293 testFloating<double>(1, 1.0000000001, 1e-6);
294 testFloating<double>(1, 1.00001, 1e-6);
295 testFloating<double>(4, 4.2, 1);
304int main(
int argc,
char* argv[])
310 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
UO_minute
minute: A time unit which is equal to 60 seconds.
MS_m_z
m/z: Three-character symbol m/z is used to denote the quantity formed by dividing the mass of an ion ...
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged.
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
UO_second
second: A time unit which is equal to the duration of 9 192 631 770 periods of the radiation correspo...
MS_peak_intensity
peak intensity: Intensity of ions as measured by the height or area of a peak in a mass spectrum.
int main(int argc, char *argv[])
void testParamContainer()
void testFloating(floating_type a, floating_type b, floating_type precision)
void testString(const string &a, const string &b)
void testIntegralReally(integral_type a, integral_type b)
void diff_floating(const floating_type &a, const floating_type &b, floating_type &a_b, floating_type &b_a, const BaseDiffConfig &config)
PWIZ_API_DECL void diff(const std::string &a, const std::string &b, std::string &a_b, std::string &b_a, const BaseDiffConfig &config)
void diff_integral(const integral_type &a, const integral_type &b, integral_type &a_b, integral_type &b_a, const BaseDiffConfig &config)
std::string diff_string(const diff_type &diff)
boost::shared_ptr< ParamGroup > ParamGroupPtr
Information about an ontology or CV source and a short 'lookup' tag to refer to.
std::string id
the short label to be used as a reference tag with which to refer to this particular Controlled Vocab...
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
std::string URI
the URI for the resource.
std::string version
the version of the CV from which the referred-to terms are drawn.
represents a tag-value pair, where the tag comes from the controlled vocabulary
Calculate diffs of objects in a ProteoWizard data model hierarchy.
The base class for elements that may contain cvParams, userParams, or paramGroup references.
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
std::vector< UserParam > userParams
a collection of uncontrolled user terms
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
Uncontrolled user parameters (essentially allowing free text). Before using these,...
CVID units
an optional CV parameter for the unit term associated with the value, if any (e.g....
std::string value
the value for the parameter, where appropriate.
std::string name
the name for the parameter.
std::string type
the datatype of the parameter, where appropriate (e.g.: xsd:float).
#define TEST_PROLOG(argc, argv)