1 /* Copyright JS Foundation and other contributors, http://js.foundation 2 * 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 TEST_COMMON_H 17 #define TEST_COMMON_H 18 19 #include "jerryscript-port.h" 20 21 #define ARRAY_SIZE(array) ((unsigned long) (sizeof (array) / sizeof ((array)[0]))) 22 23 #define JERRY_UNUSED(x) ((void) (x)) 24 25 #define TEST_ASSERT(x) \ 26 do \ 27 { \ 28 if (!(x)) \ 29 { \ 30 jerry_port_log (JERRY_LOG_LEVEL_ERROR, \ 31 "TEST: Assertion '%s' failed at %s(%s):%lu.\n", \ 32 #x, \ 33 __FILE__, \ 34 __func__, \ 35 (unsigned long) __LINE__); \ 36 jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \ 37 } \ 38 } while (0) 39 40 #define TEST_STRING_LITERAL(x) x 41 42 #endif /* !TEST_COMMON_H */ 43