Skip to content

Commit 605ac52

Browse files
committed
Remove redundant assertion. Test passed.
Issue : Remove duplicated assertions in the adau1361lower.cpp #8
1 parent 9987962 commit 605ac52

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/codec/adau1361lower.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ void ::rpp_driver::Adau1361Lower::WaitPllLock(void) {
8686
// Configure PLL and start. Then, initiate the core and set the CODEC Fs.
8787
void ::rpp_driver::Adau1361Lower::ConfigurePll(unsigned int fs,
8888
unsigned int master_clock) {
89-
assert((fs == 24000 || fs == 32000 || fs == 48000 || fs == 96000 ||
90-
fs == 22050 || fs == 44100 || fs == 88200) &&
91-
"Bad Fs");
92-
9389
if (fs == 24000 || fs == 32000 || fs == 48000 || fs == 96000) {
9490
// Configure the PLL. Target PLL out is 49.152MHz = 1024xfs
9591
// Regarding X, R, M, N, check ADAU1361 Datasheet register R1.
@@ -446,7 +442,7 @@ void ::rpp_driver::Adau1361Lower::ConfigurePll(unsigned int fs,
446442
}
447443

448444
} else { // Fs must be checked at the top of this routine.
449-
assert(false && "Wrong parameter validation");
445+
assert(false && "Wrong Fs");
450446
}
451447

452448
} // ConfigurePlll

test/test_adau1361lower.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,10 +1068,11 @@ TEST_F(Adau1361LowerDeathTest, ConfigurePll_wrong_fs) {
10681068
// Test 27MHz master clock for Fs 48kHz series.
10691069
{
10701070
const unsigned int mclock = 8000000;
1071-
const unsigned int fs = 192000;
1072-
// check the assertion for bad mclock.
1071+
const unsigned int fs = 192000; // FS 192kHz is not allowed.
1072+
// check the assertion for bad mclock.
10731073
#ifndef NDEBUG
1074-
ASSERT_DEATH(codec_lower_->ConfigurePll(fs, mclock), "Bad Fs");
1074+
ASSERT_DEATH(codec_lower_->ConfigurePll(fs, mclock),
1075+
"Wrong Fs"); // Have to assert.
10751076
#endif
10761077
}
10771078
} // ConfigurePll_wrong_fs

0 commit comments

Comments
 (0)