resolve unit test warnings

This commit is contained in:
ruil2 2014-05-22 16:03:41 +08:00 committed by ruil2
parent 6fbda11d02
commit ece06b37da
2 changed files with 12 additions and 6 deletions

View File

@ -7,6 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
9ABF4379192DE20800A6BD61 /* EncUT_MemoryAlloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9ABF4378192DE20800A6BD61 /* EncUT_MemoryAlloc.cpp */; };
FAA3D9D318BD729500BCD52D /* welsenc_ios.cfg in Resources */ = {isa = PBXBuildFile; fileRef = FAA3D9D218BD729500BCD52D /* welsenc_ios.cfg */; };
FAA3D9D818BD777100BCD52D /* CiscoVT2people_320x192_12fps.yuv in Resources */ = {isa = PBXBuildFile; fileRef = FAA3D9D718BD777100BCD52D /* CiscoVT2people_320x192_12fps.yuv */; };
FAA3D9DD18BD8A5600BCD52D /* layer2.cfg in Resources */ = {isa = PBXBuildFile; fileRef = FAA3D9DC18BD8A5600BCD52D /* layer2.cfg */; };
@ -94,6 +95,7 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
9ABF4378192DE20800A6BD61 /* EncUT_MemoryAlloc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EncUT_MemoryAlloc.cpp; path = ../../../../../test/encoder/EncUT_MemoryAlloc.cpp; sourceTree = "<group>"; };
FAA3D9D218BD729500BCD52D /* welsenc_ios.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = welsenc_ios.cfg; path = ../../../../../../testbin/welsenc_ios.cfg; sourceTree = "<group>"; };
FAA3D9D718BD777100BCD52D /* CiscoVT2people_320x192_12fps.yuv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CiscoVT2people_320x192_12fps.yuv; path = ../../../../../../res/CiscoVT2people_320x192_12fps.yuv; sourceTree = "<group>"; };
FAA3D9DC18BD8A5600BCD52D /* layer2.cfg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = layer2.cfg; path = ../../../../../../testbin/layer2.cfg; sourceTree = "<group>"; };
@ -141,6 +143,7 @@
FAFB4F9C18BC8DD700315438 = {
isa = PBXGroup;
children = (
9ABF4378192DE20800A6BD61 /* EncUT_MemoryAlloc.cpp */,
FAFB4FAE18BC8DD700315438 /* encDemo */,
FAFB4FA718BC8DD700315438 /* Frameworks */,
FAFB4FA618BC8DD700315438 /* Products */,
@ -388,6 +391,7 @@
FAFB502F18BCA50900315438 /* read_config.cpp in Sources */,
FAFB500B18BC8F6C00315438 /* welsenc.cpp in Sources */,
FAFB4FB918BC8DD700315438 /* AppDelegate.m in Sources */,
9ABF4379192DE20800A6BD61 /* EncUT_MemoryAlloc.cpp in Sources */,
FAFB4FB518BC8DD700315438 /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -18,18 +18,20 @@ TEST(MemoryAlignTest, GetCacheLineSize_LoopWithin16K) {
TEST(MemoryAlignTest, GetCacheLineSize_Zero) {
CMemoryAlign cTestMa(0);
ASSERT_EQ( 16, cTestMa.WelsGetCacheLineSize() );
const uint32_t kuiSixteen = 16;
ASSERT_EQ( kuiSixteen, cTestMa.WelsGetCacheLineSize() );
}
TEST(MemoryAlignTest, GetCacheLineSize_MaxUINT) {
CMemoryAlign cTestMa(0xFFFFFFFF);
ASSERT_EQ( 16, cTestMa.WelsGetCacheLineSize() );
const uint32_t kuiSixteen = 16;
ASSERT_EQ( kuiSixteen, cTestMa.WelsGetCacheLineSize() );
}
//Tests of WelsGetCacheLineSize End
//Tests of WelsMallocAndFree Begin
TEST(MemoryAlignTest, WelsMallocAndFreeOnceFunctionVerify) {
const uint32_t kuiTargetAlignSize[4] = {32, 16, 64, 8};
srand((uint32_t)time(NULL));
const uint32_t kuiZero = 0;
for (int i=0; i<4; i++) {
const uint32_t kuiTestAlignSize = kuiTargetAlignSize[i];
const uint32_t kuiTestDataSize = abs(rand());
@ -45,13 +47,13 @@ TEST(MemoryAlignTest, WelsMallocAndFreeOnceFunctionVerify) {
ASSERT_TRUE( (((uintptr_t)(pUnitTestData)) & kuiExtraAlignSize) == 0 );
EXPECT_EQ( kuiExpectedSize, cTestMa.WelsGetMemoryUsage() );
cTestMa.WelsFree( pUnitTestData, strUnitTestTag );
EXPECT_EQ( 0, cTestMa.WelsGetMemoryUsage() );
EXPECT_EQ( kuiZero, cTestMa.WelsGetMemoryUsage() );
}
else {
EXPECT_EQ( NULL, pUnitTestData );
EXPECT_EQ( 0, cTestMa.WelsGetMemoryUsage() );
EXPECT_EQ( kuiZero, cTestMa.WelsGetMemoryUsage() );
cTestMa.WelsFree( pUnitTestData, strUnitTestTag );
EXPECT_EQ( 0, cTestMa.WelsGetMemoryUsage() );
EXPECT_EQ( kuiZero, cTestMa.WelsGetMemoryUsage() );
}
}
}