8#include "gtest/gtest.h"
45 std::string l_Identification;
46 ASSERT_EQ(
true, pTHM1176->GetIdentification(l_Identification));
48 std::regex l_Regex(
"([^,]+),([^,]+),([^,]+),([^,]+)");
50 ASSERT_EQ(
true, std::regex_match(l_Identification, l_Match, l_Regex));
51 EXPECT_EQ(
"Metrolab Technology SA", l_Match[1].str());
52 EXPECT_EQ(
"THM1176", l_Match[2].str().substr(0, 7));
54 std::string l_SerialNumber = l_Match[3].str();
55 std::string l_Versions = l_Match[4].str();
56 EXPECT_EQ(
true, std::regex_match(l_SerialNumber, std::regex(
"^0[0-9]+$")));
57 EXPECT_EQ(
true, std::regex_match(l_Versions, l_Match, std::regex(
"^el[A-Z][0-9]-pr[A-Z][0-9]-fw[0-9]+\\.[0-9]+\\n$")));
64 ASSERT_EQ(
true, pTHM1176->GetIdentification(l_Identification));
66 EXPECT_EQ(
"Metrolab Technology SA", l_Identification.
Manufacturer);
67 EXPECT_EQ(
"THM1176", l_Identification.
Model.substr(0, 7));
83 ASSERT_EQ(
true, pTHM1176->GetAllRanges(l_Ranges));
84 EXPECT_LT(0, l_Ranges.size());
85 for (
auto l_Range : l_Ranges)
86 EXPECT_LT(0., l_Range);
93 ASSERT_EQ(
true, pTHM1176->GetAllUnits(l_Units));
94 EXPECT_LT(0, l_Units.size());
95 for (
auto l_Unit : l_Units)
97 EXPECT_LE(
kT, l_Unit);
98 EXPECT_GE(
kMHzp, l_Unit);
106 ASSERT_EQ(
true, pTHM1176->GetAllUnits(l_Units));
107 for (
auto l_Unit : l_Units)
110 ASSERT_EQ(
true, pTHM1176->GetDivisor(l_Unit, l_Divisor));
111 EXPECT_LT(0U, l_Divisor);
120 ASSERT_EQ(
true, pTHM1176->GetRotationMatrix(l_Matrix));
121 std::cout << l_Matrix << std::endl;
122 for (
int i = 0; i< 3; i++)
123 for (
int j = 0; j < 3; j++)
124 EXPECT_NEAR(l_Matrix(i,j), (i == j) ? 1. : 0., 0.1);
131 F64 l_Period1, l_Period2, l_Period3;
133 pTHM1176->GetIdentification(l_Identification)
137 EXPECT_EQ(
false, pTHM1176->GetImmediateMeasurementPeriod(l_Avg, l_Identification.
ModelRevision, l_Period1));
138 EXPECT_EQ(0., l_Period1);
142 EXPECT_EQ(
true, pTHM1176->GetImmediateMeasurementPeriod(l_Avg, l_Identification.
ModelRevision, l_Period1));
144 EXPECT_EQ(
true, pTHM1176->GetImmediateMeasurementPeriod(l_Avg, l_Identification.
ModelRevision, l_Period2));
146 EXPECT_EQ(
true, pTHM1176->GetImmediateMeasurementPeriod(l_Avg, l_Identification.
ModelRevision, l_Period3));
147 EXPECT_NEAR((l_Period2 - l_Period1), (l_Period3 - l_Period2), 1E-8);
TEST_F(CTHM1176GetUtilitiesTest, GetIdentificationString)
unsigned int U32
32-bit unsigned integer.
double F64
64-bit floating-point number.
Utility functions used to test THM1176 API.
bool ConnectToTHM1176(THM1176_TEST_RESOURCE_MANAGER_CLASS *&rpResourceManager, CTHM1176Instrument< THM1176_TEST_INSTRUMENT_CLASS, THM1176_TEST_RESOURCE_MANAGER_CLASS > *&rpTHM1176)
Connect to a THM1176.
Test THM1176 API: GetIdentification, GetAllRanges, GetAllUnits, GetDivisisor.
static CTHM1176Instrument< THM1176_TEST_INSTRUMENT_CLASS, THM1176_TEST_RESOURCE_MANAGER_CLASS > * pTHM1176
static void TearDownTestCase()
static THM1176_TEST_RESOURCE_MANAGER_CLASS * pResourceManager
static void SetUpTestCase()
THM1176 instrument class.
List of flux density values.
List of measurement units.
@ kMHzp
Equivalent proton NMR resonant frequency, in Mega-Hertz.
ParmType< U16 > NoPoints
Number of points in block average.
Instrument's identification string - parsed version.
struct sVersion FirmwareVersion
Version numbers of firmware.
std::string Manufacturer
Manufacturer name ("Metrolab Technology SA")
struct sVersion ElectronicsVersion
Version numbers of electronics.
U32 SerialNumber
Serial number.
struct sVersion ProbeVersion
Version numbers of probe.
std::string Model
Model name (e.g. "THM1176-MF")
enum eInstrModel InstrModel
Enumerator of instrument model.
enum eModelRevision ModelRevision
Revision of Model.
U8 Minor
Minor version number.
U8 Major
Major version number.