@@ -12,10 +12,11 @@ class CutAdau1361Lower : public ::rpp_driver::Adau1361Lower {
1212 : ::rpp_driver::Adau1361Lower(controller, i2c_device_addr) {};
1313 virtual void ConfigureSignalPath () {};
1414};
15+
1516class Adau1361LowerTest : public ::testing::Test {
1617 protected:
1718 virtual void SetUp () {
18- device_address_ = 31 ; // 7bit I2C address
19+ device_address_ = 0x38 ; // 7bit I2C address
1920 codec_lower_ = new ::CutAdau1361Lower (i2c_, device_address_);
2021 }
2122
@@ -28,6 +29,40 @@ class Adau1361LowerTest : public ::testing::Test {
2829
2930typedef Adau1361LowerTest Adau1361LowerDeathTest;
3031
32+ // -----------------------------------------------------------------
33+ //
34+ // Constructor Death Test
35+ //
36+ // -----------------------------------------------------------------
37+
38+ TEST (Adau1361LowerConstructorDeathTest, lower_address) {
39+ unsigned int device_address; // 7bit I2C address
40+ ::rpp_driver::MockI2cMasterInterface i2c;
41+ ::rpp_driver::Adau1361Lower* codec_lower;
42+
43+ device_address = 0x37 ; // 7bit I2C address
44+ // check the assertion for bad I2C address for Analog Device ADAU1361.
45+ // See data sheet for details.
46+ #ifndef NDEBUG
47+ ASSERT_DEATH (codec_lower = new ::CutAdau1361Lower (i2c, device_address);
48+ , " ADAU1361 I2C Address must be higher than 0x37." );
49+ #endif
50+ }
51+
52+ TEST (Adau1361LowerConstructorDeathTest, higher_address) {
53+ unsigned int device_address; // 7bit I2C address
54+ ::rpp_driver::MockI2cMasterInterface i2c;
55+ ::rpp_driver::Adau1361Lower* codec_lower;
56+
57+ device_address = 0x3C ; // 7bit I2C address
58+ // check the assertion for bad I2C address for Analog Device ADAU1361.
59+ // See data sheet for details.
60+ #ifndef NDEBUG
61+ ASSERT_DEATH (codec_lower = new ::CutAdau1361Lower (i2c, device_address);
62+ , " ADAU1361 I2C Address must be lower than 0x3C." );
63+ #endif
64+ }
65+
3166// -----------------------------------------------------------------
3267//
3368// SendCommand()
0 commit comments