• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2024 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
14require 'erb'
15require_relative 'common_gen_tests_api'
16
17abckit_scripts = File.dirname(__FILE__)
18abckit_root = File.expand_path("../", abckit_scripts)
19abckit_test = File.join(abckit_root, "/tests/null_args_tests/")
20
21excluded_funcs = [
22  "getLastError",
23  "moduleAddImportFromArkTsV2ToArkTsV2",
24  "moduleAddExportFromArkTsV2ToArkTsV2"
25]
26
27implemented_api_map = collect_implemented_api_map(excluded_funcs)
28null_args_tests_erb = File.join(abckit_test, "null_args_tests.cpp.erb")
29implemented_api_map.each_key do |domain|
30  iteration = 0
31  index = 0
32  slice_size = 100
33  api_funcs_arr = implemented_api_map[domain]
34  total_domain_api_funcs = api_funcs_arr.length
35
36  puts "#{domain}: #{total_domain_api_funcs}"
37
38  while index < total_domain_api_funcs do
39    testfile_fullpath = File.join(abckit_test, "null_args_tests_#{domain}_#{iteration}.cpp")
40    res = ERB.new(File.read(null_args_tests_erb), nil, "%").result(binding)
41    File.write(testfile_fullpath, res)
42    iteration += 1
43    index += slice_size
44  end
45end
46