ut assert

Signed-off-by: zhangbirong <zhangbirong@huawei.com>
This commit is contained in:
zhangbirong 2024-11-18 15:04:49 +08:00
parent 491335b792
commit 9f3c15e452
3 changed files with 13 additions and 18 deletions

View File

@ -168,6 +168,7 @@ HWTEST_F(EglBlobTest, EglBlobInit005, Level1)
HWTEST_F(EglBlobTest, destructBlobCacheTest001, Level1)
{
auto cache = new BlobCache();
EXPECT_NE(cache, nullptr);
cache->blobCache_ = nullptr;
delete cache;
cache = nullptr;
@ -183,6 +184,7 @@ HWTEST_F(EglBlobTest, EglBlobInit005, Level1)
auto cache = new BlobCache();
cache->blobCache_ = nullptr;
BlobCache::Get();
EXPECT_NE(cache->blobCache_, nullptr);
delete cache;
cache = nullptr;
}
@ -210,6 +212,7 @@ HWTEST_F(EglBlobTest, EglBlobInit005, Level1)
ret->Init(nullptr);
ret->initStatus_ = false;
ret->Init(nullptr);
EXPECT_FALSE(ret->initStatus_);
}
/**
@ -221,7 +224,7 @@ HWTEST_F(EglBlobTest, EglBlobInit005, Level1)
{
BlobCache* ret = BlobCache::Get();
ret->SetBlob(nullptr, 0, nullptr, 0);
ret->GetBlob(nullptr, 0, nullptr, 0);
EXPECT_EQ(ret->GetBlob(nullptr, 0, nullptr, 0), 0);
}
/**
@ -232,6 +235,7 @@ HWTEST_F(EglBlobTest, EglBlobInit005, Level1)
HWTEST_F(EglBlobTest, SetCacheDirTest, Level1)
{
BlobCache* ret = BlobCache::Get();
EXPECT_NE(ret, nullptr);
ret->SetCacheDir("SetCacheDirTest");
}
@ -246,5 +250,6 @@ HWTEST_F(EglBlobTest, EglBlobInit005, Level1)
ret->SetCacheShaderSize(0);
ret->SetCacheShaderSize(MAX_SHADER + 1);
ret->SetCacheShaderSize(1);
EXPECT_EQ(ret->blobSizeMax_, 1);
}
} // OHOS::Rosen

View File

@ -40,7 +40,7 @@ HWTEST_F(EglSystemLayersManagerTest, getJsonConfigtTest001, Level1)
{
EglSystemLayersManager manager;
Json::Value val{Json::nullValue};
manager.GetJsonConfig(val);
EXPECT_TRUE(manager.GetJsonConfig(val));
}
/**
@ -52,7 +52,8 @@ HWTEST_F(EglSystemLayersManagerTest, getSystemLayersFromConfigTest, Level1)
{
EglSystemLayersManager manager;
Json::Value val{Json::nullValue};
manager.GetSystemLayersFromConfig(val, "testName");
std::vector<std::string> config = manager.GetSystemLayersFromConfig(val, "testName");
EXPECT_TRUE(config.empty());
}
/**
@ -65,6 +66,6 @@ HWTEST_F(EglSystemLayersManagerTest, getSystemLayersTest, Level1)
EglSystemLayersManager manager;
manager.GetSystemLayers();
Json::Value val{true};
manager.GetStringVectorFromJson(val);
EXPECT_TRUE(manager.GetStringVectorFromJson(val).empty());
}
} // OHOS::Rosen

View File

@ -42,7 +42,7 @@ HWTEST_F(EglWrapperLayerTest, Init001, Level1)
{
EglWrapperDispatchTable dispatchTable;
auto result = EglWrapperLayer::GetInstance().Init(&dispatchTable);
EXPECT_FALSE(result);
EXPECT_TRUE(result);
}
/**
@ -75,6 +75,7 @@ HWTEST_F(EglWrapperLayerTest, InitLayers001, Level1)
return [](){};
};
layer.layerInit_.push_back(initFunc);
EXPECT_FALSE(layer.layerInit_.empty());
layer.layerSetup_ = {};
layer.InitLayers(&dispatchTable);
LayerSetupFunc setupFunc = [](const char* data, EglWrapperFuncPointer getAddr) -> EglWrapperFuncPointer {
@ -96,7 +97,7 @@ HWTEST_F(EglWrapperLayerTest, LoadLayers001, Level1)
EglWrapperDispatchTable dispatchTable;
bool result = EglWrapperLayer::GetInstance().LoadLayers();
ASSERT_FALSE(result);
ASSERT_TRUE(result);
}
/**
@ -110,16 +111,4 @@ HWTEST_F(EglWrapperLayerTest, InitBundleInfo001, Level1)
bool result = EglWrapperLayer::GetInstance().InitBundleInfo();
ASSERT_FALSE(result);
}
/**
* @tc.name: SetupLayerFuncTbl001
* @tc.desc:
* @tc.type: FUNC
*/
HWTEST_F(EglWrapperLayerTest, SetupLayerFuncTbl001, Level1)
{
EglWrapperDispatchTable dispatchTable;
auto& layer = EglWrapperLayer::GetInstance();
layer.SetupLayerFuncTbl(&dispatchTable);
}
} // OHOS::Rosen