• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/test.gni")
15import("//foundation/ability/ability_base/ability_base.gni")
16
17base_output_path = "aafwk/base_test"
18
19config("base_private_config") {
20  visibility = [ ":*" ]
21}
22
23ohos_unittest("base_object_test") {
24  module_out_path = base_output_path
25  sources = [ "base/base_object_test.cpp" ]
26
27  configs = [ ":base_private_config" ]
28
29  deps = [ "//third_party/googletest:gtest_main" ]
30
31  external_deps = [
32    "ability_base:base",
33    "c_utils:utils",
34  ]
35}
36
37ohos_unittest("base_test") {
38  module_out_path = base_output_path
39  sources = [ "base/base_test.cpp" ]
40
41  configs = [ ":base_private_config" ]
42
43  deps = [ "//third_party/googletest:gtest_main" ]
44
45  external_deps = [
46    "ability_base:base",
47    "c_utils:utils",
48  ]
49}
50
51ohos_unittest("bool_wrapper_test") {
52  module_out_path = base_output_path
53  sources = [ "base/bool_wrapper_test.cpp" ]
54
55  configs = [ ":base_private_config" ]
56
57  deps = [ "//third_party/googletest:gtest_main" ]
58
59  external_deps = [
60    "ability_base:base",
61    "c_utils:utils",
62  ]
63}
64
65ohos_unittest("byte_wrapper_test") {
66  module_out_path = base_output_path
67  sources = [ "base/byte_wrapper_test.cpp" ]
68
69  configs = [ ":base_private_config" ]
70
71  deps = [ "//third_party/googletest:gtest_main" ]
72
73  external_deps = [
74    "ability_base:base",
75    "c_utils:utils",
76  ]
77}
78
79ohos_unittest("double_wrapper_test") {
80  module_out_path = base_output_path
81  sources = [ "base/double_wrapper_test.cpp" ]
82
83  configs = [ ":base_private_config" ]
84
85  deps = [ "//third_party/googletest:gtest_main" ]
86
87  external_deps = [
88    "ability_base:base",
89    "c_utils:utils",
90  ]
91}
92
93ohos_unittest("float_wrapper_test") {
94  module_out_path = base_output_path
95  sources = [ "base/float_wrapper_test.cpp" ]
96
97  configs = [ ":base_private_config" ]
98
99  deps = [ "//third_party/googletest:gtest_main" ]
100
101  external_deps = [
102    "ability_base:base",
103    "c_utils:utils",
104  ]
105}
106
107ohos_unittest("int_wrapper_test") {
108  module_out_path = base_output_path
109  sources = [ "base/int_wrapper_test.cpp" ]
110
111  configs = [ ":base_private_config" ]
112
113  deps = [ "//third_party/googletest:gtest_main" ]
114
115  external_deps = [
116    "ability_base:base",
117    "c_utils:utils",
118  ]
119}
120
121ohos_unittest("long_wrapper_test") {
122  module_out_path = base_output_path
123  sources = [ "base/long_wrapper_test.cpp" ]
124
125  configs = [ ":base_private_config" ]
126
127  deps = [ "//third_party/googletest:gtest_main" ]
128
129  external_deps = [
130    "ability_base:base",
131    "c_utils:utils",
132  ]
133}
134
135######################################################################
136want_output_path = "ability_base/want_test"
137
138###############################################################################
139config("want_private_config") {
140  visibility = [ ":*" ]
141  include_dirs = [
142    "${ability_base_innerapi_path}/uri/include",
143    "${ability_base_innerapi_path}/want/include",
144  ]
145
146  defines = [ "ABILITYBASE_LOG_TAG = \"WantUnitTest\"" ]
147}
148
149config("module_private_want_param_wrapper_config") {
150  visibility = [ ":*" ]
151  include_dirs = [ "${ability_base_innerapi_path}/want/include" ]
152
153  defines = [ "ABILITYBASE_LOG_TAG = \"WantUnitTest\"" ]
154}
155
156ohos_unittest("operation_test") {
157  module_out_path = want_output_path
158  sources = [ "want/operation_test.cpp" ]
159
160  configs = [
161    ":want_private_config",
162    "${ability_base_path}:want_public_config",
163  ]
164
165  deps = [ "//third_party/googletest:gtest_main" ]
166
167  external_deps = [
168    "ability_base:base",
169    "ability_base:want",
170    "ability_base:zuri",
171    "bundle_framework:appexecfwk_base",
172    "c_utils:utils",
173  ]
174}
175
176ohos_unittest("patterns_matcher_test") {
177  module_out_path = want_output_path
178  sources = [ "want/patterns_matcher_test.cpp" ]
179
180  configs = [
181    ":want_private_config",
182    "${ability_base_path}:want_public_config",
183  ]
184
185  deps = [
186    "${ability_base_path}:base",
187    "//third_party/googletest:gtest_main",
188  ]
189
190  external_deps = [
191    "ability_base:want",
192    "bundle_framework:appexecfwk_base",
193    "c_utils:utils",
194    "hiviewdfx_hilog_native:libhilog",
195  ]
196}
197
198ohos_unittest("skills_test") {
199  module_out_path = want_output_path
200  sources = [ "want/skills_test.cpp" ]
201
202  configs = [
203    ":want_private_config",
204    "${ability_base_path}:want_public_config",
205  ]
206
207  deps = [ "//third_party/googletest:gtest_main" ]
208
209  external_deps = [
210    "ability_base:base",
211    "ability_base:want",
212    "ability_base:zuri",
213    "bundle_framework:appexecfwk_base",
214    "c_utils:utils",
215    "hiviewdfx_hilog_native:libhilog",
216  ]
217}
218
219ohos_unittest("want_params_test") {
220  module_out_path = want_output_path
221  sources = [ "want/want_params_test.cpp" ]
222
223  configs = [
224    ":want_private_config",
225    "${ability_base_path}:want_public_config",
226  ]
227
228  deps = [
229    "${ability_base_path}:base",
230    "${ability_base_path}:want",
231    "//third_party/googletest:gtest_main",
232  ]
233
234  external_deps = [
235    "bundle_framework:appexecfwk_base",
236    "c_utils:utils",
237    "hiviewdfx_hilog_native:libhilog",
238    "ipc:ipc_core",
239  ]
240}
241
242ohos_unittest("want_params_wrapper_test") {
243  module_out_path = want_output_path
244  sources = [ "want/want_params_wrapper_test.cpp" ]
245
246  configs = [ ":module_private_want_param_wrapper_config" ]
247
248  deps = [ "//third_party/googletest:gtest_main" ]
249
250  external_deps = [
251    "ability_base:base",
252    "ability_base:want",
253    "ability_base:zuri",
254    "bundle_framework:appexecfwk_base",
255    "c_utils:utils",
256    "hiviewdfx_hilog_native:libhilog",
257    "ipc:ipc_core",
258  ]
259}
260
261ohos_unittest("want_test") {
262  module_out_path = want_output_path
263  sources = [ "want/want_test.cpp" ]
264
265  configs = [
266    ":want_private_config",
267    "${ability_base_path}:want_public_config",
268  ]
269
270  deps = [ "//third_party/googletest:gtest_main" ]
271
272  external_deps = [
273    "ability_base:base",
274    "ability_base:want",
275    "ability_base:zuri",
276    "bundle_framework:appexecfwk_base",
277    "c_utils:utils",
278    "hiviewdfx_hilog_native:libhilog",
279  ]
280}
281
282ohos_unittest("uri_test") {
283  module_out_path = want_output_path
284  sources = [ "want/uri_test.cpp" ]
285
286  configs = [
287    ":want_private_config",
288    "${ability_base_path}:want_public_config",
289  ]
290
291  deps = [ "//third_party/googletest:gtest_main" ]
292
293  external_deps = [
294    "ability_base:base",
295    "ability_base:want",
296    "ability_base:zuri",
297    "bundle_framework:appexecfwk_base",
298    "c_utils:utils",
299    "hiviewdfx_hilog_native:libhilog",
300  ]
301}
302
303ohos_unittest("extra_params_test") {
304  module_out_path = want_output_path
305  sources = [ "want/extra_params_test.cpp" ]
306
307  configs = [
308    ":want_private_config",
309    "${ability_base_path}:want_public_config",
310  ]
311
312  deps = [ "//third_party/googletest:gtest_main" ]
313
314  external_deps = [
315    "ability_base:base",
316    "ability_base:want",
317    "ability_base:zuri",
318    "bundle_framework:appexecfwk_base",
319    "c_utils:utils",
320  ]
321}
322
323ohos_unittest("array_wrapper_test") {
324  module_out_path = want_output_path
325  sources = [ "want/array_wrapper_test.cpp" ]
326
327  configs = [
328    ":want_private_config",
329    "${ability_base_path}:want_public_config",
330  ]
331
332  deps = [ "//third_party/googletest:gtest_main" ]
333
334  external_deps = [
335    "ability_base:base",
336    "ability_base:want",
337    "ability_base:zuri",
338    "bundle_framework:appexecfwk_base",
339    "c_utils:utils",
340  ]
341}
342
343ohos_unittest("zchar_wrapper_test") {
344  module_out_path = base_output_path
345  sources = [ "base/zchar_wrapper_test.cpp" ]
346
347  configs = [
348    ":want_private_config",
349    "${ability_base_path}:want_public_config",
350  ]
351
352  deps = [ "//third_party/googletest:gtest_main" ]
353
354  external_deps = [
355    "ability_base:base",
356    "ability_base:want",
357    "ability_base:zuri",
358    "bundle_framework:appexecfwk_base",
359    "c_utils:utils",
360  ]
361}
362
363ohos_unittest("short_wrapper_test") {
364  module_out_path = base_output_path
365  sources = [ "base/short_wrapper_test.cpp" ]
366
367  configs = [
368    ":want_private_config",
369    "${ability_base_path}:want_public_config",
370  ]
371
372  deps = [ "//third_party/googletest:gtest_main" ]
373
374  external_deps = [
375    "ability_base:base",
376    "ability_base:want",
377    "ability_base:zuri",
378    "bundle_framework:appexecfwk_base",
379    "c_utils:utils",
380  ]
381}
382
383ohos_unittest("string_wrapper_test") {
384  module_out_path = base_output_path
385  sources = [ "base/string_wrapper_test.cpp" ]
386
387  configs = [
388    ":want_private_config",
389    "${ability_base_path}:want_public_config",
390  ]
391
392  deps = [ "//third_party/googletest:gtest_main" ]
393
394  external_deps = [
395    "ability_base:base",
396    "ability_base:want",
397    "ability_base:zuri",
398    "bundle_framework:appexecfwk_base",
399    "c_utils:utils",
400  ]
401}
402
403ohos_unittest("user_object_wrapper_test") {
404  module_out_path = base_output_path
405  sources = [ "base/user_object_wrapper_test.cpp" ]
406
407  configs = [
408    ":want_private_config",
409    "${ability_base_path}:want_public_config",
410  ]
411
412  deps = [ "//third_party/googletest:gtest_main" ]
413
414  external_deps = [
415    "ability_base:base",
416    "ability_base:want",
417    "ability_base:zuri",
418    "bundle_framework:appexecfwk_base",
419    "c_utils:utils",
420  ]
421}
422
423###############################################################################
424
425group("unittest") {
426  testonly = true
427  deps = [
428    #":base_test",
429    ":array_wrapper_test",
430    ":base_object_test",
431    ":bool_wrapper_test",
432    ":byte_wrapper_test",
433    ":double_wrapper_test",
434    ":extra_params_test",
435    ":float_wrapper_test",
436    ":int_wrapper_test",
437    ":long_wrapper_test",
438    ":operation_test",
439    ":patterns_matcher_test",
440    ":short_wrapper_test",
441    ":skills_test",
442    ":string_wrapper_test",
443    ":uri_test",
444    ":user_object_wrapper_test",
445    ":want_params_test",
446    ":want_params_wrapper_test",
447    ":want_test",
448    ":zchar_wrapper_test",
449  ]
450}
451