THM1176InstrumentManager  1.0
Qt Object abstraction for Metrolab THM1176
IEEE488InstrumentOpenCloseTest.h File Reference

Test IEEE488 Instrument: Open, Close, IsOpen methods. More...

#include <gtest/gtest.h>
#include <regex>
#include <future>
#include "IEEE488InstrumentTest.h"
Include dependency graph for IEEE488InstrumentOpenCloseTest.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  IEEE488InstrumentOpenCloseLockTest
 

Functions

static void l_OpenLoopQueryClose (IEEE4888_TEST_RESOURCE_MANAGER_CLASS *pResourceManager, std::string InstrumentName, U32 NSeconds, std::promise< bool > &rSucceeded, std::promise< U32 > &rNLoopsPerformed)
 Utility function to be run in a separate thread: open an instrument, do an *IDN?, wait a while and then close. More...
 
static void l_OpenLockWaitClose (IEEE4888_TEST_RESOURCE_MANAGER_CLASS *pResourceManager, std::string InstrumentName, U32 NSeconds, std::promise< bool > &rSucceeded)
 Utility function to be run in a separate thread: keep an instrument locked for a while. More...
 
 TEST_F (IEEE488InstrumentOpenCloseLockTest, OpenClose)
 Test Instrument object creation/destruction, Open, Close, Status, StatusDescription. More...
 
 TEST_F (IEEE488InstrumentOpenCloseLockTest, OpenCloseTwice)
 Test Instrument object creation/destruction, Open, Close, Status, StatusDescription. More...
 
 TEST_F (IEEE488InstrumentOpenCloseLockTest, ShareInstrument)
 Test two threads sharing an instrument. More...
 
 TEST_F (IEEE488InstrumentOpenCloseLockTest, LockWhenAlreadyLocked)
 
 TEST_F (IEEE488InstrumentOpenCloseLockTest, LockAfterWait)
 

Variables

static const U32 IEEE488_TEST_DURATION = 5
 

Detailed Description

Test IEEE488 Instrument: Open, Close, IsOpen methods.

Definition in file IEEE488InstrumentOpenCloseTest.h.

Function Documentation

◆ l_OpenLockWaitClose()

static void l_OpenLockWaitClose ( IEEE4888_TEST_RESOURCE_MANAGER_CLASS *  pResourceManager,
std::string  InstrumentName,
U32  NSeconds,
std::promise< bool > &  rSucceeded 
)
static

Utility function to be run in a separate thread: keep an instrument locked for a while.

Definition at line 96 of file IEEE488InstrumentOpenCloseTest.h.

◆ l_OpenLoopQueryClose()

static void l_OpenLoopQueryClose ( IEEE4888_TEST_RESOURCE_MANAGER_CLASS *  pResourceManager,
std::string  InstrumentName,
U32  NSeconds,
std::promise< bool > &  rSucceeded,
std::promise< U32 > &  rNLoopsPerformed 
)
static

Utility function to be run in a separate thread: open an instrument, do an *IDN?, wait a while and then close.

Definition at line 42 of file IEEE488InstrumentOpenCloseTest.h.

◆ TEST_F() [1/5]

TEST_F ( IEEE488InstrumentOpenCloseLockTest  ,
LockAfterWait   
)
Test:
Ensure that LockExclusive() succeeds if the instrument is already locked in another thread, but we wait long enough.

Definition at line 319 of file IEEE488InstrumentOpenCloseTest.h.

◆ TEST_F() [2/5]

TEST_F ( IEEE488InstrumentOpenCloseLockTest  ,
LockWhenAlreadyLocked   
)
Test:
Ensure that LockExclusive() fails if the instrument is already locked in another thread.

Definition at line 283 of file IEEE488InstrumentOpenCloseTest.h.

◆ TEST_F() [3/5]

TEST_F ( IEEE488InstrumentOpenCloseLockTest  ,
OpenClose   
)

Test Instrument object creation/destruction, Open, Close, Status, StatusDescription.

Definition at line 136 of file IEEE488InstrumentOpenCloseTest.h.

◆ TEST_F() [4/5]

TEST_F ( IEEE488InstrumentOpenCloseLockTest  ,
OpenCloseTwice   
)

Test Instrument object creation/destruction, Open, Close, Status, StatusDescription.

Definition at line 171 of file IEEE488InstrumentOpenCloseTest.h.

◆ TEST_F() [5/5]

TEST_F ( IEEE488InstrumentOpenCloseLockTest  ,
ShareInstrument   
)

Test two threads sharing an instrument.

Definition at line 228 of file IEEE488InstrumentOpenCloseTest.h.

Variable Documentation

◆ IEEE488_TEST_DURATION

const U32 IEEE488_TEST_DURATION = 5
static

Definition at line 37 of file IEEE488InstrumentOpenCloseTest.h.