THM1176InstrumentDriver 1.1
C++ API for Metrolab THM1176
Loading...
Searching...
No Matches
IEEE488ResourceManagerTest.h
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#pragma once
9
10#include <gtest/gtest.h>
11
13
14using namespace testing;
15
16class IEEE488ResourceManagerTest : public ::testing::Test
17{
18protected:
19 static IEEE4888_TEST_RESOURCE_MANAGER_CLASS * pResourceManager;
20
21 static void SetUpTestCase()
22 {
23 pResourceManager = new IEEE4888_TEST_RESOURCE_MANAGER_CLASS;
24 ASSERT_NE(nullptr, pResourceManager);
25 ASSERT_EQ(true, pResourceManager->Initialize());
26 }
27
28 static void TearDownTestCase()
29 {
30 delete pResourceManager;
31 pResourceManager = nullptr;
32 }
33};
34
35IEEE4888_TEST_RESOURCE_MANAGER_CLASS * IEEE488ResourceManagerTest::pResourceManager = nullptr;
36
40TEST_F(IEEE488ResourceManagerTest, FindResourcesDuringOneMinute)
41{
42 std::chrono::system_clock::time_point l_EndTime = std::chrono::system_clock::now() + std::chrono::minutes(1);
43 while (std::chrono::system_clock::now() < l_EndTime)
44 {
45 CResourceList l_ResourceList;
46 ASSERT_EQ(true, pResourceManager->FindResources(l_ResourceList, IEEE4888_TEST_RESOURCE_FILTER));
47 std::cout << l_ResourceList.Dump();
48
49 std::cout << "Status: " << pResourceManager->StatusDescription(pResourceManager->Status()) << std::endl << std::endl;
50
51 std::this_thread::sleep_for(std::chrono::seconds(1));
52 }
53}
Utility functions used to test IEEE488Instrument API.
TEST_F(IEEE488ResourceManagerTest, FindResourcesDuringOneMinute)
Test FindResources by calling it repeatedly and dumping the output. Note: to see the output in Qt Cre...
static IEEE4888_TEST_RESOURCE_MANAGER_CLASS * pResourceManager
List of VISA resource names.
std::string Dump() const
Dump the VISA resource list into a string.