History

Consistently compare integers with integers and bools with bools

MSVC warns when comparing integers with booleans in with the gtest assertion macros.

Martin Storsjö committed 11 years ago

Commit 99925981 parent cd552013 files · +14 −14Browse files

Unified · Split

3 files
  1. test/api/decoder_test.cpp +1 −1
  2. test/api/encode_decode_api_test.cpp +7 −7
  3. test/decoder/DecUT_DecExt.cpp +6 −6
test/api/decoder_test.cpp+1−1
@@ -29,7 +29,7 @@ TEST_F (DecoderCapabilityTest, JustInit) { · 28 unmodified lines
29 EXPECT_EQ (sDecCap.iMaxCpb, 20000);29 EXPECT_EQ (sDecCap.iMaxCpb, 20000);
30 EXPECT_EQ (sDecCap.iMaxDpb, 20480);30 EXPECT_EQ (sDecCap.iMaxDpb, 20480);
31 EXPECT_EQ (sDecCap.iMaxBr, 20000);31 EXPECT_EQ (sDecCap.iMaxBr, 20000);
32 EXPECT_EQ (sDecCap.bRedPicCap, 0);32 EXPECT_EQ (sDecCap.bRedPicCap, false);
33}33}
34 34
35 35
test/api/encode_decode_api_test.cpp+7−7
@@ -1594,7 +1594,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 1593 unmodified lines
1594 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //no output1594 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //no output
1595 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction1595 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction
1596 //Ref picture is ECed, so current status is ECed, when EC disable, NO output1596 //Ref picture is ECed, so current status is ECed, when EC disable, NO output
1597 EXPECT_TRUE (rv & 32);1597 EXPECT_TRUE ((rv & 32) != 0);
1598 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);1598 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);
1599 iIdx++;1599 iIdx++;
1600 1600
@@ -1689,10 +1689,10 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 88 unmodified lines
1689 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1689 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1690 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);1690 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);
1691 rv = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_);1691 rv = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_);
1692 EXPECT_TRUE (rv & 32); //parse correct, but reconstruct ECed1692 EXPECT_TRUE ((rv & 32) != 0); //parse correct, but reconstruct ECed
1693 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //ECed output for frame 01693 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //ECed output for frame 0
1694 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //ECed status, reconstruction current frame 11694 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //ECed status, reconstruction current frame 1
1695 EXPECT_TRUE (rv & 32); //decoder ECed status1695 EXPECT_TRUE ((rv & 32) != 0); //decoder ECed status
1696 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //ECed output for frame 11696 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //ECed output for frame 1
1697 iIdx++;1697 iIdx++;
1698 1698
@@ -1713,7 +1713,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 14 unmodified lines
1713 EXPECT_EQ (rv, 0); //parse correct1713 EXPECT_EQ (rv, 0); //parse correct
1714 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction1714 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction
1715 // Ref picture is ECed, so reconstructed picture is ECed1715 // Ref picture is ECed, so reconstructed picture is ECed
1716 EXPECT_TRUE (rv & 32);1716 EXPECT_TRUE ((rv & 32) != 0);
1717 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);1717 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);
1718 iIdx++;1718 iIdx++;
1719 1719
@@ -1734,7 +1734,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 14 unmodified lines
1734 EXPECT_EQ (rv, 0); //parse correct1734 EXPECT_EQ (rv, 0); //parse correct
1735 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);1735 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);
1736 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction1736 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction
1737 EXPECT_TRUE (rv & 32);1737 EXPECT_TRUE ((rv & 32) != 0);
1738 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //slice loss1738 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //slice loss
1739 iIdx++;1739 iIdx++;
1740 1740
@@ -1858,10 +1858,10 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 117 unmodified lines
1858 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1858 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1859 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);1859 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);
1860 rv = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_);1860 rv = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_);
1861 EXPECT_TRUE (rv & 32); //parse OK but frame 2 ECed1861 EXPECT_TRUE ((rv & 32) != 0); //parse OK but frame 2 ECed
1862 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //slice loss but ECed output Frame 21862 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1); //slice loss but ECed output Frame 2
1863 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction1863 rv = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); //reconstruction
1864 EXPECT_TRUE (rv & 32);1864 EXPECT_TRUE ((rv & 32) != 0);
1865 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //slice loss1865 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0); //slice loss
1866 iIdx++;1866 iIdx++;
1867 1867
test/decoder/DecUT_DecExt.cpp+6−6
@@ -271,7 +271,7 @@ void DecoderInterfaceTest::TestEndOfStream() { · 270 unmodified lines
271 EXPECT_EQ (eRet, cmResultSuccess);271 EXPECT_EQ (eRet, cmResultSuccess);
272 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);272 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
273 EXPECT_EQ (eRet, cmResultSuccess);273 EXPECT_EQ (eRet, cmResultSuccess);
274 EXPECT_EQ (iOut, iTmp != 0);274 EXPECT_EQ (iOut, iTmp != 0 ? 1 : 0);
275 }275 }
276 276
277 //set false as input277 //set false as input
@@ -281,7 +281,7 @@ void DecoderInterfaceTest::TestEndOfStream() { · 3 unmodified lines
281 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);281 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
282 EXPECT_EQ (eRet, cmResultSuccess);282 EXPECT_EQ (eRet, cmResultSuccess);
283 283
284 EXPECT_EQ (iOut, false);284 EXPECT_EQ (iOut, 0);
285 285
286 //set true as input286 //set true as input
287 iTmp = true;287 iTmp = true;
@@ -290,24 +290,24 @@ void DecoderInterfaceTest::TestEndOfStream() { · 2 unmodified lines
290 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);290 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
291 EXPECT_EQ (eRet, cmResultSuccess);291 EXPECT_EQ (eRet, cmResultSuccess);
292 292
293 EXPECT_EQ (iOut, true);293 EXPECT_EQ (iOut, 1);
294 294
295 //Mock data packet in295 //Mock data packet in
296 //Test NULL data input for decoder, should be true for EOS296 //Test NULL data input for decoder, should be true for EOS
297 eRet = (CM_RETURN) m_pDec->DecodeFrame2 (NULL, 0, m_pData, &m_sBufferInfo);297 eRet = (CM_RETURN) m_pDec->DecodeFrame2 (NULL, 0, m_pData, &m_sBufferInfo);
298 EXPECT_EQ (eRet, 0); //decode should return OK298 EXPECT_EQ (eRet, 0); //decode should return OK
299 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);299 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
300 EXPECT_EQ (iOut, true); //decoder should have EOS == true300 EXPECT_EQ (iOut, 1); //decoder should have EOS == true
301 301
302 //Test valid data input for decoder, should be false for EOS302 //Test valid data input for decoder, should be false for EOS
303 MockPacketType (NAL_UNIT_UNSPEC_0, 50);303 MockPacketType (NAL_UNIT_UNSPEC_0, 50);
304 eRet = (CM_RETURN) m_pDec->DecodeFrame2 (m_szBuffer, m_iBufLength, m_pData, &m_sBufferInfo);304 eRet = (CM_RETURN) m_pDec->DecodeFrame2 (m_szBuffer, m_iBufLength, m_pData, &m_sBufferInfo);
305 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);305 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
306 EXPECT_EQ (iOut, false); //decoder should have EOS == false306 EXPECT_EQ (iOut, 0); //decoder should have EOS == false
307 //Test NULL data input for decoder, should be true for EOS307 //Test NULL data input for decoder, should be true for EOS
308 eRet = (CM_RETURN) m_pDec->DecodeFrame2 (NULL, 0, m_pData, &m_sBufferInfo);308 eRet = (CM_RETURN) m_pDec->DecodeFrame2 (NULL, 0, m_pData, &m_sBufferInfo);
309 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);309 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOut);
310 EXPECT_EQ (iOut, true); //decoder should have EOS == true310 EXPECT_EQ (iOut, 1); //decoder should have EOS == true
311 311
312 Uninit();312 Uninit();
313}313}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t