10 #include <gtest/gtest.h>
14 using namespace testing;
19 static IEEE4888_TEST_RESOURCE_MANAGER_CLASS * pResourceManager;
20 static IEEE4888_TEST_INSTRUMENT_CLASS * pInstrument;
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_CmdBuffer(l_Command, std::strlen(l_Command));
68 ASSERT_EQ(
true, pInstrument->Write (l_CmdBuffer));
70 ASSERT_EQ(
true, pInstrument->Read (l_Buffer));
79 ASSERT_EQ(
true, pInstrument->Write (
"*IDN?"));
81 ASSERT_EQ(
true, pInstrument->Read (l_Buffer,
false));
85 ASSERT_EQ(
true, pInstrument->ReadSTB (l_Status));
86 if ((l_Status & 0x0010) == 0)
break;
87 ASSERT_EQ(
true, pInstrument->Read (l_Buffer,
true));
99 ASSERT_EQ(
false, pInstrument->Read (l_Buffer));
100 ASSERT_EQ(
true, pInstrument->Timeout());
103 ASSERT_EQ(
true, pInstrument->Write (
"*IDN?"));
104 ASSERT_EQ(
false, pInstrument->Timeout());
105 ASSERT_EQ(
true, pInstrument->Read (l_Buffer));
106 ASSERT_EQ(
false, pInstrument->Timeout());
115 std::string l_LongCommand;
116 for (
int i = 0; i < 1000; i++)
117 l_LongCommand +=
"nonsense;";
118 U32 l_Timeout = pInstrument->GetTimeout();
119 pInstrument->SetTimeout(1ul);
120 ASSERT_EQ(
false, pInstrument->Write (l_LongCommand));
121 ASSERT_EQ(
true, pInstrument->Timeout());
124 pInstrument->SetTimeout(l_Timeout);
125 ASSERT_EQ(
true, pInstrument->Write (
"*IDN?"));
126 ASSERT_EQ(
false, pInstrument->Timeout());
128 ASSERT_EQ(
true, pInstrument->Read (l_Buffer));
129 ASSERT_EQ(
false, pInstrument->Timeout());