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 #ifndef META_TEST_UTIL_HEADER
17 #define META_TEST_UTIL_HEADER
18
19 #include <base/containers/vector.h>
20 #include <core/log.h>
21
22 #include <meta/interface/intf_object_registry.h>
23 #include <meta/interface/property/construct_property.h>
24
25 META_BEGIN_NAMESPACE()
26
27 template<typename T>
CreateProperty(BASE_NS::string_view name = �, T value = {})28 typename META_NS::Property<T> CreateProperty(BASE_NS::string_view name = "", T value = {})
29 {
30 return ConstructProperty<T>(name, value);
31 }
32
33 META_END_NAMESPACE()
34
35 BASE_BEGIN_NAMESPACE()
36
37 template<typename T>
operator ==(const BASE_NS::vector<T>& l, const BASE_NS::vector<T>& r)38 bool operator==(const BASE_NS::vector<T>& l, const BASE_NS::vector<T>& r)
39 {
40 if (l.size() != r.size()) {
41 return false;
42 }
43 auto it1 = l.begin();
44 auto it2 = r.begin();
45 for (; it1 != l.end(); ++it1, ++it2) {
46 if constexpr (META_NS::HasEqualOperator_v<T>) {
47 if (!(*it1 == *it2)) {
48 return false;
49 }
50 } else {
51 return false;
52 }
53 }
54 return true;
55 }
56
57 template<typename T>
58
operator !=(const BASE_NS::vector<T>& l, const BASE_NS::vector<T>& r)59 bool operator!=(const BASE_NS::vector<T>& l, const BASE_NS::vector<T>& r)
60 {
61 return !(l == r);
62 }
63
64 BASE_END_NAMESPACE()
65 #endif