10 #include <gtest/gtest.h>
14 using namespace testing;
25 ASSERT_NE(
nullptr, pResourceManager);
26 ASSERT_NE(
nullptr, pInstrument);
27 ASSERT_EQ(
true, pInstrument->IsOpen());
28 ASSERT_EQ(
true, pInstrument->Clear());
34 pInstrument =
nullptr;
35 delete pResourceManager;
36 pResourceManager =
nullptr;
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));