THM1176InstrumentDriver  1.0
C++ API for Metrolab THM1176
CTHM1176ConnectTest.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 CTHM1176ConnectTest : public ::testing::Test
17 {
18 protected:
19  THM1176_TEST_RESOURCE_MANAGER_CLASS ResourceManager;
21  static const U32 THM1176_TIMEOUT = 5000; // ms
22 
23  virtual void SetUp()
24  {
25  ASSERT_EQ(true, FetchTHM1176Resource(ResourceManager, THM1176));
26  }
27 };
28 
30 TEST_F(CTHM1176ConnectTest, ConnectDisconnect)
31 {
33  ASSERT_EQ(true, l_THM1176.Connect(THM1176_TIMEOUT));
34  ASSERT_EQ(true, l_THM1176.IsOpen());
35  l_THM1176.Disconnect();
36  ASSERT_EQ(false, l_THM1176.IsOpen());
37 }
38 
THM1176TestUtilities.h
Utility functions used to test THM1176 API.
TEST_F
TEST_F(CTHM1176ConnectTest, ConnectDisconnect)
Definition: CTHM1176ConnectTest.cpp:30
MTL::Instrument::CTHM1176Instrument< THM1176_TEST_INSTRUMENT_CLASS, THM1176_TEST_RESOURCE_MANAGER_CLASS >
CTHM1176ConnectTest::SetUp
virtual void SetUp()
Definition: CTHM1176ConnectTest.cpp:23
MTL::Instrument::CTHM1176Instrument::Disconnect
void Disconnect()
Close the connection to the instrument.
Definition: THM1176.cpp:879
FetchTHM1176Resource
bool FetchTHM1176Resource(THM1176_TEST_RESOURCE_MANAGER_CLASS &rResourceManager, tResourceName &rTHM1176)
Open a connection to the Resource Manager and find a THM1176.
Definition: THM1176TestUtilities.cpp:15
MTL::Instrument
Definition: THM1176.h:75
MTL::Instrument::THM1176Types
Definition: THM1176TypeConversions.h:20
MTL::Instrument::CTHM1176Instrument::Connect
bool Connect(U32 InitialTimeout, bool Exclusive=true)
Open the connection to the instrument.
Definition: THM1176.cpp:812
CTHM1176ConnectTest
Test THM1176 API: Connect, Disconnect.
Definition: CTHM1176ConnectTest.cpp:17
CTHM1176ConnectTest::ResourceManager
THM1176_TEST_RESOURCE_MANAGER_CLASS ResourceManager
Definition: CTHM1176ConnectTest.cpp:19
MTL::Instrument::tResourceName
std::string tResourceName
IEEE488 resource name.
Definition: IEEE488InstrumentTypes.h:22
CTHM1176ConnectTest::THM1176
tResourceName THM1176
Definition: CTHM1176ConnectTest.cpp:20
U32
unsigned int U32
32-bit unsigned integer.
Definition: OSDefines.h:32
THM1176TypeConversions.h
Type conversion routines for C++ API for Metrolab THM1176/TFM1186.