summaryrefslogtreecommitdiff
path: root/AudioManagerDaemon
diff options
context:
space:
mode:
authorAleksandar Donchev <Aleksander.Donchev@partner.bmw.de>2014-03-28 16:34:25 +0100
committerChristian Linke <christian.linke@bmw.de>2014-03-28 16:48:03 +0100
commit7666421ecaa46c0244e6272db80e0192aed47a28 (patch)
treee6ff9ef6c2bb67df96a1929d8d1c3c3e851a43b2 /AudioManagerDaemon
parent4e95ee075a723ba9270cbd33704a553e51823795 (diff)
downloadaudiomanager-7666421ecaa46c0244e6272db80e0192aed47a28.tar.gz
* Some unit tests fixed due issues occured on pocky build systems.
Signed-off-by: Christian Linke <christian.linke@bmw.de>
Diffstat (limited to 'AudioManagerDaemon')
-rw-r--r--AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp20
-rw-r--r--AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp1
-rw-r--r--AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp11
3 files changed, 26 insertions, 6 deletions
diff --git a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp b/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
index 2dba164..ae05960 100644
--- a/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
+++ b/AudioManagerDaemon/test/AmMapHandlerTest/CAmMapHandlerTest.cpp
@@ -2268,7 +2268,10 @@ TEST_F(CAmMapHandlerTest, peekDomain_2)
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
ASSERT_EQ(domainID, domain2ID); // FAILS, ID is 2 instead of 1
- ASSERT_TRUE(listDomains[0].domainID==domainID);
+ bool containsDomainID = std::find_if(listDomains.begin(), listDomains.end(), [&](const am_Domain_s & ref) {
+ return ref.domainID==domainID;
+ })!=listDomains.end();
+ ASSERT_TRUE(containsDomainID);
}
TEST_F(CAmMapHandlerTest, connectionIDBoundary)
@@ -2475,7 +2478,10 @@ TEST_F(CAmMapHandlerObserverCallbacksTest, peek_enter_removeDomain)
ASSERT_EQ(E_OK, pDatabaseHandler.enterDomainDB(domain,domain2ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListDomains(listDomains));
ASSERT_EQ(domainID, domain2ID); // FAILS, ID is 2 instead of 1
- ASSERT_TRUE(listDomains[0].domainID==domainID);
+ bool containsDomainID = std::find_if(listDomains.begin(), listDomains.end(), [&](const am_Domain_s & ref) {
+ return ref.domainID==domainID;
+ })!=listDomains.end();
+ ASSERT_TRUE(containsDomainID);
EXPECT_CALL(*MockDatabaseObserver::getMockObserverObject(), removeDomain(domainID)).Times(1);
ASSERT_EQ(E_OK,pDatabaseHandler.removeDomainDB(domainID))<< "ERROR: database error";
EXPECT_TRUE(Mock::VerifyAndClearExpectations(MockDatabaseObserver::getMockObserverObject()));
@@ -2513,7 +2519,10 @@ TEST_F(CAmMapHandlerObserverCallbacksTest, peek_enter_update_removeSource)
ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceDB(source,source3ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSources(listSources));
ASSERT_EQ(sourceID, source3ID);
- ASSERT_TRUE(listSources[0].sourceID==sourceID);
+ bool containsSourceID = std::find_if(listSources.begin(), listSources.end(), [&](const am_Source_s & ref) {
+ return ref.sourceID==sourceID;
+ })!=listSources.end();
+ ASSERT_TRUE(containsSourceID);
std::vector<am_SoundProperty_s> listSoundProperties;
std::vector<am_ConnectionFormat_e> listConnectionFormats;
std::vector<am_MainSoundProperty_s> listMainSoundProperties;
@@ -2556,7 +2565,10 @@ TEST_F(CAmMapHandlerObserverCallbacksTest, peek_enter_update_removeSink)
ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkDB(sink,sink3ID));
ASSERT_EQ(E_OK, pDatabaseHandler.getListSinks(listSinks));
ASSERT_EQ(sinkID, sink3ID);
- ASSERT_TRUE(listSinks[0].sinkID==sinkID);
+ bool containsSourceID = std::find_if(listSinks.begin(), listSinks.end(), [&](const am_Sink_s & ref) {
+ return ref.sinkID==sinkID;
+ })!=listSinks.end();
+ ASSERT_TRUE(containsSourceID);
std::vector<am_SoundProperty_s> listSoundProperties;
std::vector<am_ConnectionFormat_e> listConnectionFormats;
std::vector<am_MainSoundProperty_s> listMainSoundProperties;
diff --git a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp
index 0833dde..e41e556 100644
--- a/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp
+++ b/AudioManagerDaemon/test/AmNodeStateCommunicatorCAPITest/CAmNodeStateCommunicatorTest.cpp
@@ -164,6 +164,7 @@ TEST_F(CAmNodeStateCommunicatorTest, receiveLifecycleRequest)
std::ostringstream send;
send << "python send2nsm.py LifecycleRequest "<<Request<<" "<<RequestID;
system(send.str().c_str());
+ sleep(2);
}
TEST_F(CAmNodeStateCommunicatorTest, UnRegisterShutdownClient)
diff --git a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp b/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
index 4c55c34..2ea9639 100644
--- a/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
+++ b/AudioManagerDaemon/test/AmRouterMapTest/CAmRouterMapTest.cpp
@@ -1248,8 +1248,15 @@ TEST_F(CAmRouterMapTest,simpleRoute4Domains2Routes)
ASSERT_EQ(E_OK, pRouter.getRoute(false,sourceID,sinkID,listRoutes));
ASSERT_EQ(static_cast<uint>(2), listRoutes.size());
- ASSERT_TRUE(pCF.compareRoute(compareRoute,listRoutes[0]));
- ASSERT_TRUE(pCF.compareRoute(compareRoute1,listRoutes[1]));
+
+ bool containsRoute1 = std::find_if(listRoutes.begin(), listRoutes.end(), [&](const am_Route_s & ref) {
+ return pCF.compareRoute(compareRoute, ref);
+ })!=listRoutes.end();
+ bool containsRoute2 = std::find_if(listRoutes.begin(), listRoutes.end(), [&](const am_Route_s & ref) {
+ return pCF.compareRoute(compareRoute1, ref);
+ })!=listRoutes.end();
+ ASSERT_TRUE(containsRoute1);
+ ASSERT_TRUE(containsRoute2);
}
//test that checks 3 domains, one sink one source but the connectionformat of third domains do not fit.