10#include <gtest/gtest.h>
14using namespace testing;
46 ASSERT_EQ(
true, pInstrument->Write (
"*IDN?"));
48 ASSERT_EQ(
true, pInstrument->Read (l_Buffer));
56 ASSERT_EQ(
true, pInstrument->Write (std::string(
"*IDN?")));
58 ASSERT_EQ(
true, pInstrument->Read (l_Buffer));
66 const char * l_Command =
"*IDN?";
67 CSCPIBuffer l_Buffer(l_Command, std::strlen(l_Command));
68 ASSERT_EQ(
true, pInstrument->Write (l_Buffer));
69 ASSERT_EQ(
true, pInstrument->Read (l_Buffer));
78 ASSERT_EQ(
true, pInstrument->Write (
"*IDN?"));
80 ASSERT_EQ(
true, pInstrument->Read (l_Buffer,
false));
84 ASSERT_EQ(
true, pInstrument->ReadSTB (l_Status));
85 if ((l_Status & 0x0010) == 0)
break;
86 ASSERT_EQ(
true, pInstrument->Read (l_Buffer,
true));
98 ASSERT_EQ(
false, pInstrument->Read (l_Buffer));
101 ASSERT_EQ(
true, pInstrument->Write (
"*IDN?"));
102 ASSERT_EQ(
true, pInstrument->Read (l_Buffer));
111 std::string l_LongCommand;
112 for (
int i = 0; i < 100; i++)
113 l_LongCommand +=
"*RST;";
114 U32 l_Timeout = pInstrument->GetTimeout();
115 pInstrument->SetTimeout(1ul);
116 ASSERT_EQ(
false, pInstrument->Write (l_LongCommand));
119 pInstrument->SetTimeout(l_Timeout);
120 ASSERT_EQ(
true, pInstrument->Write (
"*IDN?"));
122 ASSERT_EQ(
true, pInstrument->Read (l_Buffer));
TEST_F(IEEE488InstrumentReadWriteTest, IDN_Query_WriteCString)
Test *IDN? query with C string variant of Write.
bool ConnectToIEEE488Instrument(IEEE4888_TEST_RESOURCE_MANAGER_CLASS *&rpResourceManager, IEEE4888_TEST_INSTRUMENT_CLASS *&rpInstrument)
Connect to an IEEE488Instrument.
bool CheckIDNResponse(const CSCPIBuffer &rBuffer)
Sanity-check of the response to an *IDN? query.
Utility functions used to test IEEE488Instrument API.
unsigned int U32
32-bit unsigned integer.
unsigned short U16
16-bit unsigned integer.
static void TearDownTestCase()
static IEEE4888_TEST_INSTRUMENT_CLASS * pInstrument
static IEEE4888_TEST_RESOURCE_MANAGER_CLASS * pResourceManager
static void SetUpTestCase()