39 if (
os_) *
os_ <<
"diff_string(\"" << a <<
"\", \"" << b <<
"\")" << endl;
43 if (
os_) *
os_ <<
"a-b: " << a_b <<
"\nb-a: " << b_a << endl;
51 template <
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());
64 template <
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);
74 template <
typename floating_type>
75 void testFloating(floating_type a, floating_type b, floating_type precision)
77 floating_type a_b, b_a;
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";
109 if (
os_) *
os_ << diff << endl;
121 if (
os_) *
os_ <<
"testUserParam()\n";
135 b.
value =
"value_changed";
138 if (
os_) *
os_ << diff << endl;
151 if (
os_) *
os_ <<
"testCVParam()\n";
163 b.
value =
"value_changed";
166 if (
os_) *
os_ << diff << endl;
175 if (
os_) *
os_ << diff << endl;
185 if (
os_) *
os_ << diff << endl;
188 c.
value =
"410000.0";
191 if (
os_) *
os_ << diff << endl;
197 if (
os_) *
os_ << diff << endl;
205 if (
os_) *
os_ <<
"testParamContainer()\n";
230 if (
os_) *
os_ << diff << endl;
252 if (
os_) *
os_ <<
"testParamGroup()\n";
255 a.userParams.push_back(
UserParam(
"common"));
261 a.userParams.push_back(
UserParam(
"different",
"1"));
265 if (
os_) *
os_ << diff << endl;
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);
304 int main(
int argc,
char* argv[])
310 if (argc>1 && !strcmp(argv[1],
"-v"))
os_ = &cout;
std::string id
the short label to be used as a reference tag with which to refer to this particular Controlled Vocab...
MS_charge_state
charge state: The charge state of the ion, single or multiple and positive or negatively charged...
bool empty() const
returns ture iff id, URI, fullName, and version are all empty
boost::shared_ptr< ParamGroup > ParamGroupPtr
std::string value
the value for the parameter, where appropriate.
void testIntegralReally(integral_type a, integral_type b)
Calculate diffs of objects in a ProteoWizard data model hierarchy.
Information about an ontology or CV source and a short 'lookup' tag to refer to.
UO_second
second: A time unit which is equal to the duration of 9 192 631 770 periods of the radiation correspo...
bool empty() const
returns true iff name, value, type, and units are all empty
MS_peak_intensity
peak intensity: Intensity of ions as measured by the height or area of a peak in a mass spectrum...
void diff(const string &filename1, const string &filename2)
std::string fullName
the usual name for the resource (e.g. The PSI-MS Controlled Vocabulary).
Uncontrolled user parameters (essentially allowing free text). Before using these, one should verify whether there is an appropriate CV term available, and if so, use the CV term instead.
std::vector< UserParam > userParams
a collection of uncontrolled user terms
std::string type
the datatype of the parameter, where appropriate (e.g.: xsd:float).
MS_m_z
m/z: Three-character symbol m/z is used to denote the quantity formed by dividing the mass of an ion ...
std::string diff_string(const diff_type &diff)
MS_ionization_type
ionization type: The method by which gas phase ions are generated from the sample.
The base class for elements that may contain cvParams, userParams, or paramGroup references.
std::string URI
the URI for the resource.
std::vector< CVParam > cvParams
a collection of controlled vocabulary terms
int main(int argc, char *argv[])
std::vector< ParamGroupPtr > paramGroupPtrs
a collection of references to ParamGroups
void testFloating(floating_type a, floating_type b, floating_type precision)
std::string name
the name for the parameter.
A collection of CVParam and UserParam elements that can be referenced from elsewhere in this mzML doc...
UO_minute
minute: A time unit which is equal to 60 seconds.
CVID units
an optional CV parameter for the unit term associated with the value, if any (e.g. MS_electron_volt).
void testString(const string &a, const string &b)
void testParamContainer()
#define TEST_PROLOG(argc, argv)
void diff_floating(const floating_type &a, const floating_type &b, floating_type &a_b, floating_type &b_a, const BaseDiffConfig &config)
std::string version
the version of the CV from which the referred-to terms are drawn.
void diff_integral(const integral_type &a, const integral_type &b, integral_type &a_b, integral_type &b_a, const BaseDiffConfig &config)
represents a tag-value pair, where the tag comes from the controlled vocabulary