diff --git a/test/unittest/updater_binary/update_partitions_unittest.cpp b/test/unittest/updater_binary/update_partitions_unittest.cpp index 8b17113c986ecb0af97c5d33ba07c3e7112c1c29..099616210ca56ab3d08bed36444cabdbb72eb060 100755 --- a/test/unittest/updater_binary/update_partitions_unittest.cpp +++ b/test/unittest/updater_binary/update_partitions_unittest.cpp @@ -129,22 +129,11 @@ HWTEST_F(UpdatePartitionsUnitTest, UpdatePartitions_Unitest04, TestSize.Level1) } )"; cJSON *root = cJSON_Parse(partitionInfo); - if (root == nullptr) { - cout << "cJSON_Parse error" << endl; - return; - } + ASSERT_NE(root, nullptr); cJSON *partitions = cJSON_GetObjectItem(root, "Partition"); - if (partitions == nullptr) { - cout << "cJSON_GetObjectItem error" << endl; - cJSON_Delete(root); - return; - } + ASSERT_NE(partitions, nullptr); struct Partition *myPartition = static_cast(calloc(1, sizeof(struct Partition))); - if (!myPartition) { - cout << "calloc error" << endl; - cJSON_Delete(root); - return; - } + ASSERT_NE(myPartition, nullptr); UpdatePartitions partition; EXPECT_TRUE(!partition.SetPartitionInfo(partitions, 10, myPartition)); // 10: error index