| THM1176InstrumentDriver 1.2 C++ API for Metrolab THM1176

Loading...
Searching...
No Matches
CTHM1176BasicsTest.cpp
Go to the documentation of this file.
1// Copyright (c) 2020 Metrolab Technology S.A., Geneva, Switzerland (www.metrolab.com)
2// See the included file LICENSE.txt for the licensing conditions.
3
7
8#include "gtest/gtest.h"
9#include "THM1176TestUtilities.h"
10#include "THM1176TypeConversions.h"
11
12 using namespace MTL::Instrument;
13 using namespace MTL::Instrument::THM1176Types;
14
16 class CTHM1176BasicsTest : public ::testing::Test
17{
18};
19
21 TEST_F(CTHM1176BasicsTest, TestTHM1176Types)
22{
23 EXPECT_EQ(true, TestTHM1176Types());
24}
25
27 TEST_F(CTHM1176BasicsTest, CFluxList)
28{
29 // Set up the objects.
30 CFluxList l_Object1;
31 l_Object1.push_back(1.);
32 l_Object1.push_back(2.);
33 l_Object1.push_back(3.);
34 CFluxList l_Object2 = l_Object1;
35
36 // Test equality.
37 EXPECT_EQ(true, l_Object1 == l_Object2);
38 EXPECT_EQ(false, l_Object1 != l_Object2);
39
40 // Test inequality: different number of elements.
41 l_Object2.pop_back();
42 EXPECT_EQ(false, l_Object1 == l_Object2);
43 EXPECT_EQ(true, l_Object1 != l_Object2);
44
45 // Test inequality: one element different.
46 l_Object2 = l_Object1;
47 l_Object2[2] = 4.;
48 EXPECT_EQ(false, l_Object1 == l_Object2);
49 EXPECT_EQ(true, l_Object1 != l_Object2);
50
51 // Test clear.
52 l_Object2.clear();
53 EXPECT_EQ(0, l_Object2.size());
54}
55
57 TEST_F(CTHM1176BasicsTest, CUnitsList)
58{
59 // Set up the objects.
60 CUnitsList l_Object1;
61 l_Object1.push_back(kT);
62 l_Object1.push_back(kmT);
63 l_Object1.push_back(kuT);
64 CUnitsList l_Object2 = l_Object1;
65
66 // Test equality.
67 EXPECT_EQ(true, l_Object1 == l_Object2);
68 EXPECT_EQ(false, l_Object1 != l_Object2);
69
70 // Test inequality: different number of elements.
71 l_Object2.pop_back();
72 EXPECT_EQ(false, l_Object1 == l_Object2);
73 EXPECT_EQ(true, l_Object1 != l_Object2);
74
75 // Test inequality: one element different.
76 l_Object2 = l_Object1;
77 l_Object2[2] = knT;
78 EXPECT_EQ(false, l_Object1 == l_Object2);
79 EXPECT_EQ(true, l_Object1 != l_Object2);
80
81 // Test clear.
82 l_Object2.clear();
83 EXPECT_EQ(0, l_Object2.size());
84}
85
87 TEST_F(CTHM1176BasicsTest, CDivisorList)
88{
89 // Set up the objects.
90 CDivisorList l_Object1;
91 l_Object1.push_back(1);
92 l_Object1.push_back(2);
93 l_Object1.push_back(3);
94 CDivisorList l_Object2 = l_Object1;
95
96 // Test equality.
97 EXPECT_EQ(true, l_Object1 == l_Object2);
98 EXPECT_EQ(false, l_Object1 != l_Object2);
99
100 // Test inequality: different number of elements.
101 l_Object2.pop_back();
102 EXPECT_EQ(false, l_Object1 == l_Object2);
103 EXPECT_EQ(true, l_Object1 != l_Object2);
104
105 // Test inequality: one element different.
106 l_Object2 = l_Object1;
107 l_Object2[2] = 4;
108 EXPECT_EQ(false, l_Object1 == l_Object2);
109 EXPECT_EQ(true, l_Object1 != l_Object2);
110
111 // Test clear.
112 l_Object2.clear();
113 EXPECT_EQ(0, l_Object2.size());
114}
115
117 TEST_F(CTHM1176BasicsTest, CErrorList)
118{
119 // Set up the objects.
120 sError l_Error;
121 CErrorList l_Object1;
122 l_Error = { 1, "a", "A" };
123 l_Object1.push_back(l_Error);
124 l_Error = { 1, "b", "B" };
125 l_Object1.push_back(l_Error);
126 l_Error = { 1, "c", "C" };
127 l_Object1.push_back(l_Error);
128 CErrorList l_Object2 = l_Object1;
129
130 // Test equality.
131 EXPECT_EQ(true, l_Object1 == l_Object2);
132 EXPECT_EQ(false, l_Object1 != l_Object2);
133
134 // Test inequality: different number of elements.
135 l_Object2.pop_back();
136 EXPECT_EQ(false, l_Object1 == l_Object2);
137 EXPECT_EQ(true, l_Object1 != l_Object2);
138
139 // Test inequality: one element different.
140 l_Error = { 1, "d", "D" };
141 l_Object1.push_back(l_Error);
142 EXPECT_EQ(false, l_Object1 == l_Object2);
143 EXPECT_EQ(true, l_Object1 != l_Object2);
144
145 // Test clear.
146 l_Object2.clear();
147 EXPECT_EQ(0, l_Object2.size());
148}
149
151 TEST_F(CTHM1176BasicsTest, sIdentifier)
152{
153 // Set up the objects.
154 sIdentifier l_Object1 = { "A", "B", 1, {2, 3}, {4, 5}, {6, 7}, eModelRevision::kA, eInstrModel::kTHM1176MF};
155 sIdentifier l_Object2 = l_Object1;
156
157 // Test equality.
158 EXPECT_EQ(true, l_Object1 == l_Object2);
159 EXPECT_EQ(false, l_Object1 != l_Object2);
160
161 // Test inequality: different Manufacturer.
162 l_Object2 = l_Object1;
163 l_Object2.Manufacturer = "C";
164 EXPECT_EQ(false, l_Object1 == l_Object2);
165 EXPECT_EQ(true, l_Object1 != l_Object2);
166
167 // Test inequality: different Model.
168 l_Object2 = l_Object1;
169 l_Object2.Model = "C";
170 EXPECT_EQ(false, l_Object1 == l_Object2);
171 EXPECT_EQ(true, l_Object1 != l_Object2);
172
173 // Test inequality: different SerialNumber.
174 l_Object2 = l_Object1;
175 l_Object2.SerialNumber = 8;
176 EXPECT_EQ(false, l_Object1 == l_Object2);
177 EXPECT_EQ(true, l_Object1 != l_Object2);
178
179 // Test inequality: different ElectronicsVersion.Major.
180 l_Object2 = l_Object1;
181 l_Object2.ElectronicsVersion.Major = 9;
182 EXPECT_EQ(false, l_Object1 == l_Object2);
183 EXPECT_EQ(true, l_Object1 != l_Object2);
184
185 // Test inequality: different ElectronicsVersion.Minor.
186 l_Object2 = l_Object1;
187 l_Object2.ElectronicsVersion.Minor = 10;
188 EXPECT_EQ(false, l_Object1 == l_Object2);
189 EXPECT_EQ(true, l_Object1 != l_Object2);
190
191 // Test inequality: different ProbeVersion.Major.
192 l_Object2 = l_Object1;
193 l_Object2.ProbeVersion.Major = 11;
194 EXPECT_EQ(false, l_Object1 == l_Object2);
195 EXPECT_EQ(true, l_Object1 != l_Object2);
196
197 // Test inequality: different ProbeVersion.Minor.
198 l_Object2 = l_Object1;
199 l_Object2.ProbeVersion.Minor = 12;
200 EXPECT_EQ(false, l_Object1 == l_Object2);
201 EXPECT_EQ(true, l_Object1 != l_Object2);
202
203 // Test inequality: different FirmwareVersion.Major.
204 l_Object2 = l_Object1;
205 l_Object2.FirmwareVersion.Major = 13;
206 EXPECT_EQ(false, l_Object1 == l_Object2);
207 EXPECT_EQ(true, l_Object1 != l_Object2);
208
209 // Test inequality: different FirmwareVersion.Minor.
210 l_Object2 = l_Object1;
211 l_Object2.FirmwareVersion.Minor = 14;
212 EXPECT_EQ(false, l_Object1 == l_Object2);
213 EXPECT_EQ(true, l_Object1 != l_Object2);
214
215 // Test inequality: different Model Revision.
216 l_Object2 = l_Object1;
217 l_Object2.ModelRevision = eModelRevision::kB;
218 EXPECT_EQ(false, l_Object1 == l_Object2);
219 EXPECT_EQ(true, l_Object1 != l_Object2);
220
221 // Test inequality: different Instrument Model.
222 l_Object2 = l_Object1;
223 l_Object2.InstrModel = eInstrModel::kTFM1186;
224 EXPECT_EQ(false, l_Object1 == l_Object2);
225 EXPECT_EQ(true, l_Object1 != l_Object2);
226
227 // Test clear.
228 l_Object1 = { "", "", 0, {0, 0}, {0, 0}, {0, 0}};
229 l_Object2.clear();
230 EXPECT_EQ(true, l_Object1 == l_Object2);
231}
232
234 TEST_F(CTHM1176BasicsTest, sAveraging_uParm)
235{
236 // Set up the objects.
237 sAveraging<uParm> l_Object1 = { 1 };
238 sAveraging<uParm> l_Object2 = l_Object1;
239
240 // Test equality.
241 EXPECT_EQ(true, l_Object1 == l_Object2);
242 EXPECT_EQ(false, l_Object1 != l_Object2);
243
244 // Test inequality: different NoPoints.
245 l_Object2 = l_Object1;
246 l_Object2.NoPoints = 2;
247 EXPECT_EQ(false, l_Object1 == l_Object2);
248 EXPECT_EQ(true, l_Object1 != l_Object2);
249
250 // Test clear.
251 l_Object1 = { 0 };
252 l_Object2.clear();
253 EXPECT_EQ(true, l_Object1 == l_Object2);
254}
255
257 TEST_F(CTHM1176BasicsTest, sAveraging_sBoundedParm)
258{
259 // Set up the objects.
260 sAveraging<sBoundedParm> l_Object1 = { { 1, 2, 3, 4} };
261 sAveraging<sBoundedParm> l_Object2 = l_Object1;
262
263 // Test equality.
264 EXPECT_EQ(true, l_Object1 == l_Object2);
265 EXPECT_EQ(false, l_Object1 != l_Object2);
266
267 // Test inequality: different NoPoints.Val.
268 l_Object2 = l_Object1;
269 l_Object2.NoPoints.Val = 5;
270 EXPECT_EQ(false, l_Object1 == l_Object2);
271 EXPECT_EQ(true, l_Object1 != l_Object2);
272
273 // Test inequality: different NoPoints.Min.
274 l_Object2 = l_Object1;
275 l_Object2.NoPoints.Min = 6;
276 EXPECT_EQ(false, l_Object1 == l_Object2);
277 EXPECT_EQ(true, l_Object1 != l_Object2);
278
279 // Test inequality: different NoPoints.Max.
280 l_Object2 = l_Object1;
281 l_Object2.NoPoints.Max = 7;
282 EXPECT_EQ(false, l_Object1 == l_Object2);
283 EXPECT_EQ(true, l_Object1 != l_Object2);
284
285 // Test inequality: different NoPoints.Def.
286 l_Object2 = l_Object1;
287 l_Object2.NoPoints.Def = 8;
288 EXPECT_EQ(false, l_Object1 == l_Object2);
289 EXPECT_EQ(true, l_Object1 != l_Object2);
290
291 // Test clear.
292 l_Object1 = { { 0, 0, 0, 0 } };
293 l_Object2.clear();
294 EXPECT_EQ(true, l_Object1 == l_Object2);
295}
296
298 TEST_F(CTHM1176BasicsTest, sInputTrigger_uParm)
299{
300 // Set up the objects.
301 sInputTrigger<uParm> l_Object1 = { kInputTrigSrcImmediate, 1., 2 };
302 sInputTrigger<uParm> l_Object2 = l_Object1;
303
304 // Test equality.
305 EXPECT_EQ(true, l_Object1 == l_Object2);
306 EXPECT_EQ(false, l_Object1 != l_Object2);
307
308 // Test inequality: different Source.
309 l_Object2 = l_Object1;
310 l_Object2.Source = kInputTrigSrcTimer;
311 EXPECT_EQ(false, l_Object1 == l_Object2);
312 EXPECT_EQ(true, l_Object1 != l_Object2);
313
314 // Test inequality: different Period_s.
315 l_Object2 = l_Object1;
316 l_Object2.Period_s = 3.;
317 EXPECT_EQ(false, l_Object1 == l_Object2);
318 EXPECT_EQ(true, l_Object1 != l_Object2);
319
320 // Test inequality: different Count.
321 l_Object2 = l_Object1;
322 l_Object2.Count = 4;
323 EXPECT_EQ(false, l_Object1 == l_Object2);
324 EXPECT_EQ(true, l_Object1 != l_Object2);
325
326 // Test clear.
327 l_Object1 = { kInputTrigSrcImmediate, 0., 0 };
328 l_Object2.clear();
329 EXPECT_EQ(true, l_Object1 == l_Object2);
330}
331
333 TEST_F(CTHM1176BasicsTest, sInputTrigger_sBoundedParm)
334{
335 // Set up the objects.
336 sInputTrigger<sBoundedParm> l_Object1 = { kInputTrigSrcImmediate, { 1., 2., 3., 4.}, {5, 6, 7, 8 } };
337 sInputTrigger<sBoundedParm> l_Object2 = l_Object1;
338
339 // Test equality.
340 EXPECT_EQ(true, l_Object1 == l_Object2);
341 EXPECT_EQ(false, l_Object1 != l_Object2);
342
343 // Test inequality: different Source.
344 l_Object2 = l_Object1;
345 l_Object2.Source = kInputTrigSrcTimer;
346 EXPECT_EQ(false, l_Object1 == l_Object2);
347 EXPECT_EQ(true, l_Object1 != l_Object2);
348
349 // Test inequality: different Period_s.Val.
350 l_Object2 = l_Object1;
351 l_Object2.Period_s.Val = 9.;
352 EXPECT_EQ(false, l_Object1 == l_Object2);
353 EXPECT_EQ(true, l_Object1 != l_Object2);
354
355 // Test inequality: different Period_s.Min.
356 l_Object2 = l_Object1;
357 l_Object2.Period_s.Min = 10.;
358 EXPECT_EQ(false, l_Object1 == l_Object2);
359 EXPECT_EQ(true, l_Object1 != l_Object2);
360
361 // Test inequality: different Period_s.Max.
362 l_Object2 = l_Object1;
363 l_Object2.Period_s.Max = 11.;
364 EXPECT_EQ(false, l_Object1 == l_Object2);
365 EXPECT_EQ(true, l_Object1 != l_Object2);
366
367 // Test inequality: different Period_s.Def.
368 l_Object2 = l_Object1;
369 l_Object2.Period_s.Def = 12.;
370 EXPECT_EQ(false, l_Object1 == l_Object2);
371 EXPECT_EQ(true, l_Object1 != l_Object2);
372
373 // Test inequality: different Count.Val.
374 l_Object2 = l_Object1;
375 l_Object2.Count.Val = 13;
376 EXPECT_EQ(false, l_Object1 == l_Object2);
377 EXPECT_EQ(true, l_Object1 != l_Object2);
378
379 // Test inequality: different Count.Min.
380 l_Object2 = l_Object1;
381 l_Object2.Count.Min = 14;
382 EXPECT_EQ(false, l_Object1 == l_Object2);
383 EXPECT_EQ(true, l_Object1 != l_Object2);
384
385 // Test inequality: different Count.Max.
386 l_Object2 = l_Object1;
387 l_Object2.Count.Max = 15;
388 EXPECT_EQ(false, l_Object1 == l_Object2);
389 EXPECT_EQ(true, l_Object1 != l_Object2);
390
391 // Test inequality: different Count.Def.
392 l_Object2 = l_Object1;
393 l_Object2.Count.Def = 16;
394 EXPECT_EQ(false, l_Object1 == l_Object2);
395 EXPECT_EQ(true, l_Object1 != l_Object2);
396
397 // Test clear.
398 l_Object1 = { kInputTrigSrcImmediate, { 0., 0., 0., 0. }, { 0, 0, 0, 0 } };
399 l_Object2.clear();
400 EXPECT_EQ(true, l_Object1 == l_Object2);
401}
402
404 TEST_F(CTHM1176BasicsTest, sRange_uParm)
405{
406 // Set up the objects.
407 sRange<uParm> l_Object1 = { true, 1. };
408 sRange<uParm> l_Object2 = l_Object1;
409
410 // Test equality.
411 EXPECT_EQ(true, l_Object1 == l_Object2);
412 EXPECT_EQ(false, l_Object1 != l_Object2);
413
414 // Test inequality: different Auto.
415 l_Object2 = l_Object1;
416 l_Object2.Auto = false;
417 EXPECT_EQ(false, l_Object1 == l_Object2);
418 EXPECT_EQ(true, l_Object1 != l_Object2);
419
420 // Test inequality: different Range.
421 l_Object2 = l_Object1;
422 l_Object2.Range = 2.;
423 EXPECT_EQ(false, l_Object1 == l_Object2);
424 EXPECT_EQ(true, l_Object1 != l_Object2);
425
426 // Test clear.
427 l_Object1 = { false, 0. };
428 l_Object2.clear();
429 EXPECT_EQ(true, l_Object1 == l_Object2);
430}
431
433 TEST_F(CTHM1176BasicsTest, sRange_sBoundedParm)
434{
435 // Set up the objects.
436 sRange<sBoundedParm> l_Object1 = { true, { 1., 2., 3., 4.} };
437 sRange<sBoundedParm> l_Object2 = l_Object1;
438
439 // Test equality.
440 EXPECT_EQ(true, l_Object1 == l_Object2);
441 EXPECT_EQ(false, l_Object1 != l_Object2);
442
443 // Test inequality: different Auto.
444 l_Object2 = l_Object1;
445 l_Object2.Auto = false;
446 EXPECT_EQ(false, l_Object1 == l_Object2);
447 EXPECT_EQ(true, l_Object1 != l_Object2);
448
449 // Test inequality: different Range.Val.
450 l_Object2 = l_Object1;
451 l_Object2.Range.Val = 5.;
452 EXPECT_EQ(false, l_Object1 == l_Object2);
453 EXPECT_EQ(true, l_Object1 != l_Object2);
454
455 // Test inequality: different Range.Min.
456 l_Object2 = l_Object1;
457 l_Object2.Range.Min = 6.;
458 EXPECT_EQ(false, l_Object1 == l_Object2);
459 EXPECT_EQ(true, l_Object1 != l_Object2);
460
461 // Test inequality: different Range.Max.
462 l_Object2 = l_Object1;
463 l_Object2.Range.Max = 7.;
464 EXPECT_EQ(false, l_Object1 == l_Object2);
465 EXPECT_EQ(true, l_Object1 != l_Object2);
466
467 // Test inequality: different Range.Def.
468 l_Object2 = l_Object1;
469 l_Object2.Range.Def = 8.;
470 EXPECT_EQ(false, l_Object1 == l_Object2);
471 EXPECT_EQ(true, l_Object1 != l_Object2);
472
473 // Test clear.
474 l_Object1 = { false, { 0., 0., 0., 0. } };
475 l_Object2.clear();
476 EXPECT_EQ(true, l_Object1 == l_Object2);
477}
478
480 TEST_F(CTHM1176BasicsTest, sFile)
481{
482 // Set up the objects.
483 sFile l_Object1 = { 1, "A", "B" };
484 sFile l_Object2 = l_Object1;
485
486 // Test equality.
487 EXPECT_EQ(true, l_Object1 == l_Object2);
488 EXPECT_EQ(false, l_Object1 != l_Object2);
489
490 // Test inequality: different Path.
491 l_Object2 = l_Object1;
492 l_Object2.Path = "C";
493 EXPECT_EQ(false, l_Object1 == l_Object2);
494 EXPECT_EQ(true, l_Object1 != l_Object2);
495
496 // Test inequality: different Type.
497 l_Object2 = l_Object1;
498 l_Object2.Type = "D";
499 EXPECT_EQ(false, l_Object1 == l_Object2);
500 EXPECT_EQ(true, l_Object1 != l_Object2);
501
502 // Test inequality: different Size.
503 l_Object2 = l_Object1;
504 l_Object2.Size = 2;
505 EXPECT_EQ(false, l_Object1 == l_Object2);
506 EXPECT_EQ(true, l_Object1 != l_Object2);
507
508 // Test clear.
509 l_Object1 = { 0, "", "" };
510 l_Object2.clear();
511 EXPECT_EQ(true, l_Object1 == l_Object2);
512}
513
515 TEST_F(CTHM1176BasicsTest, CAbsoluteTimestamp)
516{
517 // Set up the objects.
518 CAbsoluteTimestamp l_Object1(1, 2);
519 CAbsoluteTimestamp l_Object2 = l_Object1;
520 CAbsoluteTimestamp l_Object3;
521
522 // Test accessors.
523 EXPECT_EQ(l_Object1.seconds(), 1);
524 EXPECT_EQ(l_Object1.nanoseconds(), 2);
525
526 // Test equality.
527 EXPECT_EQ(true, l_Object1 == l_Object2);
528 EXPECT_EQ(false, l_Object1 != l_Object2);
529
530 // Test modulo operation in constructor.
531 l_Object2 = CAbsoluteTimestamp(0, 1000000002);
532 EXPECT_EQ(true, l_Object1 == l_Object2);
533 EXPECT_EQ(false, l_Object1 != l_Object2);
534
535 // Test inequality: different s.
536 l_Object2 = CAbsoluteTimestamp(3, 2);
537 EXPECT_EQ(false, l_Object1 == l_Object2);
538 EXPECT_EQ(true, l_Object1 != l_Object2);
539
540 // Test inequality: different ns.
541 l_Object2 = CAbsoluteTimestamp(1, 4);
542 EXPECT_EQ(false, l_Object1 == l_Object2);
543 EXPECT_EQ(true, l_Object1 != l_Object2);
544
545 // Test addition: normal.
546 l_Object2 = CAbsoluteTimestamp(3, 4);
547 l_Object3 = l_Object1 + l_Object2;
548 EXPECT_EQ(l_Object3.seconds(), 4);
549 EXPECT_EQ(l_Object3.nanoseconds(), 6);
550
551 // Test addition: with carry.
552 l_Object2 = CAbsoluteTimestamp(3, 999999999);
553 l_Object3 = l_Object1 + l_Object2;
554 EXPECT_EQ(l_Object3.seconds(), 5);
555 EXPECT_EQ(l_Object3.nanoseconds(), 1);
556
557 // Test subtraction: normal.
558 l_Object2 = CAbsoluteTimestamp(3, 4);
559 l_Object3 = l_Object2 - l_Object1;
560 EXPECT_EQ(l_Object3.seconds(), 2);
561 EXPECT_EQ(l_Object3.nanoseconds(), 2);
562
563 // Test subtraction: with carry.
564 l_Object2 = CAbsoluteTimestamp(3, 1);
565 l_Object3 = l_Object2 - l_Object1;
566 EXPECT_EQ(l_Object3.seconds(), 1);
567 EXPECT_EQ(l_Object3.nanoseconds(), 999999999);
568}
569
571 TEST_F(CTHM1176BasicsTest, sArbitraryMeasurements)
572{
573 // Set up the objects.
574 sArbitraryMeasurements l_Object1 = { false, false, false, false, false, 100 };
575 sArbitraryMeasurements l_Object2 = l_Object1;
576
577 // Test equality.
578 EXPECT_EQ(true, l_Object1 == l_Object2);
579 EXPECT_EQ(false, l_Object1 != l_Object2);
580
581 // Test inequality: different Bx.
582 l_Object2 = l_Object1;
583 l_Object2.Bx = true;
584 EXPECT_EQ(false, l_Object1 == l_Object2);
585 EXPECT_EQ(true, l_Object1 != l_Object2);
586
587 // Test inequality: different By.
588 l_Object2 = l_Object1;
589 l_Object2.By = true;
590 EXPECT_EQ(false, l_Object1 == l_Object2);
591 EXPECT_EQ(true, l_Object1 != l_Object2);
592
593 // Test inequality: different Bz.
594 l_Object2 = l_Object1;
595 l_Object2.Bz = true;
596 EXPECT_EQ(false, l_Object1 == l_Object2);
597 EXPECT_EQ(true, l_Object1 != l_Object2);
598
599 // Test inequality: different Temperature.
600 l_Object2 = l_Object1;
601 l_Object2.Temperature = true;
602 EXPECT_EQ(false, l_Object1 == l_Object2);
603 EXPECT_EQ(true, l_Object1 != l_Object2);
604
605 // Test inequality: different Timestamp.
606 l_Object2 = l_Object1;
607 l_Object2.Timestamp = true;
608 EXPECT_EQ(false, l_Object1 == l_Object2);
609 EXPECT_EQ(true, l_Object1 != l_Object2);
610
611 // Test inequality: different NoMeasurements.
612 l_Object2 = l_Object1;
613 l_Object2.NoMeasurements = 200;
614 EXPECT_EQ(false, l_Object1 == l_Object2);
615 EXPECT_EQ(true, l_Object1 != l_Object2);
616
617 // Test clear.
618 l_Object1 = { true, true, true, true, true, 1 };
619 l_Object2.clear();
620 EXPECT_EQ(true, l_Object1 == l_Object2);
621}
TEST_F
TEST_F(CTHM1176BasicsTest, TestTHM1176Types)
Definition CTHM1176BasicsTest.cpp:21
THM1176TestUtilities.h
Utility functions used to test THM1176 API.
THM1176TypeConversions.h
Type conversion routines for C++ API for Metrolab THM1176/TFM1186.
CTHM1176BasicsTest
Test THM1176 API: Type conversions and THM1176 classes.
Definition CTHM1176BasicsTest.cpp:17
MTL::Instrument::THM1176Types::CAbsoluteTimestamp
Timestamp for a measurement.
Definition THM1176Types.h:551
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::seconds
std::time_t seconds(void) const
Fetch the number of seconds.
Definition THM1176Types.cpp:363
MTL::Instrument::THM1176Types::CAbsoluteTimestamp::nanoseconds
U64 nanoseconds(void) const
Fetch the number of nanoseconds.
Definition THM1176Types.cpp:367
MTL::Instrument::THM1176Types::CDivisorList
List of divisors, one per measurement unit.
Definition THM1176Types.h:203
MTL::Instrument::THM1176Types::CErrorList
List of errors returned by the instrument.
Definition THM1176Types.h:232
MTL::Instrument::THM1176Types::CFluxList
List of flux density values.
Definition THM1176Types.h:170
MTL::Instrument::THM1176Types::CUnitsList
List of measurement units.
Definition THM1176Types.h:194
MTL::Instrument::THM1176Types
Definition THM1176TypeConversions.h:20
MTL::Instrument::THM1176Types::eInstrModel::kTHM1176MF
@ kTHM1176MF
Definition THM1176Types.h:337
MTL::Instrument::THM1176Types::eInstrModel::kTFM1186
@ kTFM1186
Definition THM1176Types.h:340
MTL::Instrument::THM1176Types::TestTHM1176Types
bool TestTHM1176Types()
Test the conversion routines.
Definition THM1176TypeConversions.cpp:88
MTL::Instrument::THM1176Types::kA
@ kA
Definition THM1176Types.h:347
MTL::Instrument::THM1176Types::kB
@ kB
Definition THM1176Types.h:347
MTL::Instrument::THM1176Types::kInputTrigSrcTimer
@ kInputTrigSrcTimer
Timed trigger: start measurement at regular intervals.
Definition THM1176Types.h:419
MTL::Instrument::THM1176Types::kInputTrigSrcImmediate
@ kInputTrigSrcImmediate
Immediate trigger: start measurement immediately after previous one completes.
Definition THM1176Types.h:418
MTL::Instrument::THM1176Types::knT
@ knT
Nano-Tesla.
Definition THM1176Types.h:186
MTL::Instrument::THM1176Types::kmT
@ kmT
Milli-Tesla.
Definition THM1176Types.h:184
MTL::Instrument::THM1176Types::kT
@ kT
Tesla.
Definition THM1176Types.h:183
MTL::Instrument::THM1176Types::kuT
@ kuT
Micro-Tesla.
Definition THM1176Types.h:185
MTL::Instrument
Definition THM1176.h:74
MTL::Instrument::THM1176Types::sArbitraryMeasurements
Specify the measurement data to be returned.
Definition THM1176Types.h:593
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Bx
bool Bx
Return the flux density X-component.
Definition THM1176Types.h:594
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Temperature
bool Temperature
Return the sensor temperature.
Definition THM1176Types.h:597
MTL::Instrument::THM1176Types::sArbitraryMeasurements::By
bool By
Return the flux density Y-component.
Definition THM1176Types.h:595
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Bz
bool Bz
Return the flux density Z-component.
Definition THM1176Types.h:596
MTL::Instrument::THM1176Types::sArbitraryMeasurements::clear
void clear()
Clear to default values.
Definition THM1176Types.cpp:488
MTL::Instrument::THM1176Types::sArbitraryMeasurements::Timestamp
bool Timestamp
Return the timestamp.
Definition THM1176Types.h:598
MTL::Instrument::THM1176Types::sArbitraryMeasurements::NoMeasurements
U32 NoMeasurements
Return this number of measurements.
Definition THM1176Types.h:599
MTL::Instrument::THM1176Types::sAveraging
Averaging parameter.
Definition THM1176Types.h:388
MTL::Instrument::THM1176Types::sAveraging::NoPoints
ParmType< U16 > NoPoints
Number of points in block average.
Definition THM1176Types.h:389
MTL::Instrument::THM1176Types::sAveraging::clear
void clear(void)
Clear to default (zero).
Definition THM1176Types.h:397
MTL::Instrument::THM1176Types::sError
Error returned by the instrument.
Definition THM1176Types.h:214
MTL::Instrument::THM1176Types::sFile
Directory entry in the instrument's file system.
Definition THM1176Types.h:514
MTL::Instrument::THM1176Types::sFile::clear
void clear()
Clear to default values.
Definition THM1176Types.cpp:308
MTL::Instrument::THM1176Types::sFile::Path
std::string Path
File path.
Definition THM1176Types.h:516
MTL::Instrument::THM1176Types::sFile::Type
std::string Type
File type ("ASCII" or "BINARY").
Definition THM1176Types.h:517
MTL::Instrument::THM1176Types::sFile::Size
size_t Size
File size, in bytes.
Definition THM1176Types.h:515
MTL::Instrument::THM1176Types::sIdentifier
Instrument's identification string - parsed version.
Definition THM1176Types.h:353
MTL::Instrument::THM1176Types::sIdentifier::FirmwareVersion
struct sVersion FirmwareVersion
Version numbers of firmware.
Definition THM1176Types.h:359
MTL::Instrument::THM1176Types::sIdentifier::Manufacturer
std::string Manufacturer
Manufacturer name ("Metrolab Technology SA").
Definition THM1176Types.h:354
MTL::Instrument::THM1176Types::sIdentifier::ElectronicsVersion
struct sVersion ElectronicsVersion
Version numbers of electronics.
Definition THM1176Types.h:357
MTL::Instrument::THM1176Types::sIdentifier::SerialNumber
U32 SerialNumber
Serial number.
Definition THM1176Types.h:356
MTL::Instrument::THM1176Types::sIdentifier::ProbeVersion
struct sVersion ProbeVersion
Version numbers of probe.
Definition THM1176Types.h:358
MTL::Instrument::THM1176Types::sIdentifier::Model
std::string Model
Model name (e.g. "THM1176-MF").
Definition THM1176Types.h:355
MTL::Instrument::THM1176Types::sIdentifier::clear
void clear(void)
Clear to default.
Definition THM1176Types.cpp:198
MTL::Instrument::THM1176Types::sIdentifier::InstrModel
enum eInstrModel InstrModel
Enumerator of instrument model.
Definition THM1176Types.h:361
MTL::Instrument::THM1176Types::sIdentifier::ModelRevision
enum eModelRevision ModelRevision
Revision of Model.
Definition THM1176Types.h:360
MTL::Instrument::THM1176Types::sInputTrigger
Input trigger parameter.
Definition THM1176Types.h:426
MTL::Instrument::THM1176Types::sInputTrigger::Count
ParmType< U16 > Count
Trigger count: take this many measurements before sending results.
Definition THM1176Types.h:429
MTL::Instrument::THM1176Types::sInputTrigger::Source
eInputTriggerSource Source
Trigger source.
Definition THM1176Types.h:427
MTL::Instrument::THM1176Types::sInputTrigger::clear
void clear(void)
Clear to default.
Definition THM1176Types.h:439
MTL::Instrument::THM1176Types::sInputTrigger::Period_s
ParmType< F64 > Period_s
Trigger period, for timed trigger.
Definition THM1176Types.h:428
MTL::Instrument::THM1176Types::sRange
Measurement range parameter.
Definition THM1176Types.h:479
MTL::Instrument::THM1176Types::sRange::clear
void clear(void)
Clear to default values.
Definition THM1176Types.h:490
MTL::Instrument::THM1176Types::sRange::Auto
bool Auto
Auto-ranging enabled.
Definition THM1176Types.h:480
MTL::Instrument::THM1176Types::sRange::Range
ParmType< tFlux > Range
Measurement range, if auto-ranging is not enabled.
Definition THM1176Types.h:481
MTL::Instrument::THM1176Types::sVersion::Minor
U8 Minor
Minor version number.
Definition THM1176Types.h:316
MTL::Instrument::THM1176Types::sVersion::Major
U8 Major
Major version number.
Definition THM1176Types.h:315