1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include <gtest/gtest.h> 17 18 #include <memory.h> 19 #include "hash_calculator.h" 20 21 using namespace OHOS; 22 using namespace OHOS::AVSession; 23 24 class HashCalculatorTest : public testing::Test { 25 public: 26 static void SetUpTestCase(void); 27 static void TearDownTestCase(void); 28 void SetUp(); 29 void TearDown(); 30 }; 31 SetUpTestCase()32void HashCalculatorTest::SetUpTestCase() 33 {} 34 TearDownTestCase()35void HashCalculatorTest::TearDownTestCase() 36 {} 37 SetUp()38void HashCalculatorTest::SetUp() 39 {} 40 TearDown()41void HashCalculatorTest::TearDown() 42 {} 43 44 /** 45 * @tc.name: Update001 46 * @tc.desc: test Update 47 * @tc.type: FUNC 48 * @tc.require: 49 */ 50 static HWTEST_F(HashCalculatorTest, Update001, testing::ext::TestSize.Level1) 51 { 52 HashCalculator hashCalculator; 53 std::vector<uint8_t> vec; 54 int32_t result = hashCalculator.Update(vec); 55 EXPECT_EQ(result, AVSESSION_ERROR); 56 result = hashCalculator.GetResult(vec); 57 EXPECT_EQ(result, AVSESSION_ERROR); 58 }