diff options
author | christian mueller <christian.ei.mueller@bmw.de> | 2012-02-01 10:50:15 +0100 |
---|---|---|
committer | christian mueller <christian.ei.mueller@bmw.de> | 2012-02-01 14:01:29 +0100 |
commit | 9f4c15a8e89d798077ca3edf7f786dbc740aa176 (patch) | |
tree | 878af38925ee08720418790d85b9938877aa452e /AudioManagerDaemon/test/database | |
parent | 52a769615e476860f3e4c0196fdf7e5159a7a7c1 (diff) | |
download | audiomanager-9f4c15a8e89d798077ca3edf7f786dbc740aa176.tar.gz |
* implemented peeksinkclassIDs and peeksourceclassIDs
* changed interface of both from const to non-const
* corrected include headers to c++ style, eg. <cassert>
* corrected sendChangedData return type to void
* implemented tests for sinkclass and sourceclass peeking
* fixed bug in sockethandler (FD could not be removed) thanks to Frank
Diffstat (limited to 'AudioManagerDaemon/test/database')
-rw-r--r-- | AudioManagerDaemon/test/database/databaseTest.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/AudioManagerDaemon/test/database/databaseTest.cpp b/AudioManagerDaemon/test/database/databaseTest.cpp index 6122505..a44804b 100644 --- a/AudioManagerDaemon/test/database/databaseTest.cpp +++ b/AudioManagerDaemon/test/database/databaseTest.cpp @@ -147,13 +147,60 @@ void routingTest::createMainConnectionSetup() void routingTest::SetUp() { - logInfo("Database Test started "); } void routingTest::TearDown() { } +TEST_F(routingTest, peekSourceID) +{ + EXPECT_CALL(pMockInterface,cbNumberOfSourceClassesChanged()).Times(1); + std::string sourceName("myClassID"); + am_sourceClass_t sourceClassID, peekID; + am_SourceClass_s sourceClass; + am_ClassProperty_s classProperty; + classProperty.classProperty = CP_SOURCE_TYPE; + classProperty.value = 13; + sourceClass.name = sourceName; + sourceClass.sourceClassID = 0; + sourceClass.listClassProperties.push_back(classProperty); + + //first we peek without an existing class + ASSERT_EQ(E_NON_EXISTENT, pDatabaseHandler.peekSourceClassID(sourceName,sourceClassID)); + + //now we enter the class into the database + ASSERT_EQ(E_OK, pDatabaseHandler.enterSourceClassDB(sourceClassID,sourceClass)); + + //first we peek without an existing class + ASSERT_EQ(E_OK, pDatabaseHandler.peekSourceClassID(sourceName,peekID)); + ASSERT_EQ(sourceClassID, peekID); +} + +TEST_F(routingTest, peekSinkID) +{ + EXPECT_CALL(pMockInterface,cbNumberOfSinkClassesChanged()).Times(1); + std::string sinkName("myClassID"); + am_sinkClass_t sinkClassID, peekID; + am_SinkClass_s sinkClass; + am_ClassProperty_s classProperty; + classProperty.classProperty = CP_SOURCE_TYPE; + classProperty.value = 13; + sinkClass.name = sinkName; + sinkClass.sinkClassID = 0; + sinkClass.listClassProperties.push_back(classProperty); + + //first we peek without an existing class + ASSERT_EQ(E_NON_EXISTENT, pDatabaseHandler.peekSinkClassID(sinkName,sinkClassID)); + + //now we enter the class into the database + ASSERT_EQ(E_OK, pDatabaseHandler.enterSinkClassDB(sinkClass,sinkClassID)); + + //first we peek without an existing class + ASSERT_EQ(E_OK, pDatabaseHandler.peekSinkClassID(sinkName,peekID)); + ASSERT_EQ(sinkClassID, peekID); +} + TEST_F(routingTest,crossfaders) { //todo:implement crossfader tests @@ -1592,6 +1639,8 @@ TEST_F(routingTest,enterSinksCorrect) int main(int argc, char **argv) { + DLTWrapper::instance()->registerApp("databse", "databasetest"); + logInfo("Database Test started "); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } |