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 <base/containers/byte_array.h> 19 20 using namespace BASE_NS; 21 using namespace testing::ext; 22 23 class ByteArrayTest : public testing::Test { 24 public: SetUpTestSuite()25 static void SetUpTestSuite() {} TearDownTestSuite()26 static void TearDownTestSuite() {} SetUp()27 void SetUp() override {} TearDown()28 void TearDown() override {} 29 }; 30 31 HWTEST_F(ByteArrayTest, constuctor, TestSize.Level1) 32 { 33 ByteArray(128U); 34 } 35 36 HWTEST_F(ByteArrayTest, getData, TestSize.Level1) 37 { 38 { 39 constexpr auto size = 128U; 40 auto array = ByteArray(size); 41 auto data = array.GetData(); 42 EXPECT_EQ(data.size(), size); 43 } 44 { 45 constexpr const auto size = 128U; 46 const auto array = ByteArray(size); 47 const auto data = array.GetData(); 48 EXPECT_EQ(data.size(), size); 49 } 50 } 51