1 /**
2 * Copyright (c) 2023-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 #include "ets_interop_js_gtest.h"
18
19 namespace ark::ets::interop::js::testing {
20
21 class ESCompatTest : public EtsInteropTest {};
22
TEST_F(ESCompatTest,compat_array)23 TEST_F(ESCompatTest, compat_array)
24 {
25 ASSERT_EQ(true, RunJsTestSuite("compat_array.js"));
26 }
27
28 // NOTE(oignatenko) uncomment Array_TestJSLength code after interop is implemented from JS to eTS
TEST_F(ESCompatTest,compat_array_length)29 TEST_F(ESCompatTest, compat_array_length)
30 {
31 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_length.js"));
32 }
33
TEST_F(ESCompatTest,compat_array_pop)34 TEST_F(ESCompatTest, compat_array_pop)
35 {
36 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_pop.js"));
37 }
38
TEST_F(ESCompatTest,compat_array_fill)39 TEST_F(ESCompatTest, compat_array_fill)
40 {
41 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_fill.js"));
42 }
43
TEST_F(ESCompatTest,compat_array_shift)44 TEST_F(ESCompatTest, compat_array_shift)
45 {
46 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_shift.js"));
47 }
48
49 // NOTE(oignatenko) uncomment Array_TestJSSlice code after interop is implemented from JS to eTS
TEST_F(ESCompatTest,compat_array_slice)50 TEST_F(ESCompatTest, compat_array_slice)
51 {
52 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_slice.js"));
53 }
54
55 // NOTE(oignatenko) uncomment Array_TestJSSplice code after interop is implemented from JS to eTS
TEST_F(ESCompatTest,compat_array_splice)56 TEST_F(ESCompatTest, compat_array_splice)
57 {
58 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_splice.js"));
59 }
60
61 // NOTE(oignatenko) uncomment test_to_spliced.js code after recent regression making it work in place is fixed
TEST_F(ESCompatTest,compat_array_to_spliced)62 TEST_F(ESCompatTest, compat_array_to_spliced)
63 {
64 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_to_spliced.js"));
65 }
66
67 // NOTE(oignatenko) uncomment Array_TestJSCopyWithin code after interop is implemented from JS to eTS
TEST_F(ESCompatTest,compat_array_copy_within)68 TEST_F(ESCompatTest, compat_array_copy_within)
69 {
70 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_copy_within.js"));
71 }
72
73 // NOTE(oignatenko) uncomment Array_TestJSWith code after interop is implemented from JS to eTS
TEST_F(ESCompatTest,compat_array_with)74 TEST_F(ESCompatTest, compat_array_with)
75 {
76 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_with.js"));
77 }
78
TEST_F(ESCompatTest,compat_array_last_index_of)79 TEST_F(ESCompatTest, compat_array_last_index_of)
80 {
81 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_last_index_of.js"));
82 }
83
84 // NOTE(oignatenko) uncomment Array_TestJSToReversed code after interop is implemented from JS to eTS
TEST_F(ESCompatTest,compat_array_to_reversed)85 TEST_F(ESCompatTest, compat_array_to_reversed)
86 {
87 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_to_reversed.js"));
88 }
89
90 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_sort)91 TEST_F(ESCompatTest, DISABLED_compat_array_sort)
92 {
93 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_sort.js"));
94 }
95
96 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_to_sorted)97 TEST_F(ESCompatTest, DISABLED_compat_array_to_sorted)
98 {
99 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_to_sorted.js"));
100 }
101
102 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_join)103 TEST_F(ESCompatTest, DISABLED_compat_array_join)
104 {
105 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_join.js"));
106 }
107
108 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_some)109 TEST_F(ESCompatTest, DISABLED_compat_array_some)
110 {
111 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_some.js"));
112 }
113
114 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_every)115 TEST_F(ESCompatTest, DISABLED_compat_array_every)
116 {
117 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_every.js"));
118 }
119
120 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_filter)121 TEST_F(ESCompatTest, DISABLED_compat_array_filter)
122 {
123 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_filter.js"));
124 }
125
126 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_filter_array)127 TEST_F(ESCompatTest, DISABLED_compat_array_filter_array)
128 {
129 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_filter_array.js"));
130 }
131
132 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_map)133 TEST_F(ESCompatTest, DISABLED_compat_array_map)
134 {
135 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_map.js"));
136 }
137
138 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_flat_map)139 TEST_F(ESCompatTest, DISABLED_compat_array_flat_map)
140 {
141 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_flat_map.js"));
142 }
143
144 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_reduce)145 TEST_F(ESCompatTest, DISABLED_compat_array_reduce)
146 {
147 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_reduce.js"));
148 }
149
150 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_reduce_right)151 TEST_F(ESCompatTest, DISABLED_compat_array_reduce_right)
152 {
153 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_reduce_right.js"));
154 }
155
156 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_find_last)157 TEST_F(ESCompatTest, DISABLED_compat_array_find_last)
158 {
159 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_find_last.js"));
160 }
161
162 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_find_index)163 TEST_F(ESCompatTest, DISABLED_compat_array_find_index)
164 {
165 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_find_index.js"));
166 }
167
168 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_find)169 TEST_F(ESCompatTest, DISABLED_compat_array_find)
170 {
171 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_find.js"));
172 }
173
174 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_is_array)175 TEST_F(ESCompatTest, DISABLED_compat_array_is_array)
176 {
177 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_is_array.js"));
178 }
179
180 // NOTE(oignatenko) enable this after interop is implemented for this method in either or both dimensions
TEST_F(ESCompatTest,DISABLED_compat_array_from_async)181 TEST_F(ESCompatTest, DISABLED_compat_array_from_async)
182 {
183 ASSERT_EQ(true, RunJsTestSuite("array_js_suites/test_from_async.js"));
184 }
185
186 // NOTE(vpukhov): fix boxed primitives casts
TEST_F(ESCompatTest,DISABLED_compat_boolean)187 TEST_F(ESCompatTest, DISABLED_compat_boolean)
188 {
189 ASSERT_EQ(true, RunJsTestSuite("compat_boolean.js"));
190 }
191
192 // NOTE(vpukhov): compat accessors
TEST_F(ESCompatTest,DISABLED_compat_error)193 TEST_F(ESCompatTest, DISABLED_compat_error)
194 {
195 ASSERT_EQ(true, RunJsTestSuite("compat_error.js"));
196 }
197
TEST_F(ESCompatTest,json_stringify)198 TEST_F(ESCompatTest, json_stringify)
199 {
200 ASSERT_EQ(true, RunJsTestSuite("compat_stringify.js"));
201 }
202
203 } // namespace ark::ets::interop::js::testing
204