d9112701bb45cb3599a6db6d2317777bf6155822
[framework/web/wrt-commons.git] / tests / test / runner_child.cpp
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /*
17  * @file    widget_version.cpp
18  * @author  Bartlomiej Grzelewski (b.grzelewski@samsung.com)
19  * @version 1.0
20  * @brief   Implementation file for test cases for engine internal tests
21  */
22 #include <dpl/test/test_runner_child.h>
23 #include <unistd.h>
24 #include <vector>
25 #include <sys/types.h>
26 #include <signal.h>
27
28 RUNNER_TEST_GROUP_INIT(DPL_TESTS_TEST_CHILD)
29
30 RUNNER_TEST(t00_pass)
31 {
32     RUNNER_ASSERT_MSG(1, "This test should pass");
33 }
34
35 RUNNER_CHILD_TEST(t01_pass)
36 {
37     RUNNER_ASSERT_MSG(1, "This test should pass");
38 }
39
40 RUNNER_CHILD_TEST(t02_fail)
41 {
42     RUNNER_ASSERT_MSG(0, "This test should fail");
43 }
44
45 RUNNER_CHILD_TEST(t03_fail_timeout)
46 {
47     sleep(20);
48     RUNNER_ASSERT_MSG(1, "This test should fail");
49 }
50
51 RUNNER_CHILD_TEST(t04_fail)
52 {
53     RUNNER_ASSERT_MSG(1, "This test should fail");
54     RUNNER_ASSERT_MSG(1, "This test should fail");
55     RUNNER_ASSERT_MSG(1, "This test should fail");
56     RUNNER_ASSERT_MSG(1, "This test should fail");
57     RUNNER_ASSERT_MSG(0, "This test should fail");
58 }
59
60 RUNNER_CHILD_TEST(t05_fail_child_died)
61 {
62     kill(getpid(), SIGKILL);
63     RUNNER_ASSERT_MSG(1, "This test should fail");
64 }
65
66 RUNNER_CHILD_TEST(t06_pass_8_second_test)
67 {
68     sleep(8);
69     RUNNER_ASSERT_MSG(1, "This test should pass");
70 }
71
72 RUNNER_CHILD_TEST(t07_fail_unknown_exception)
73 {
74     throw("hello");
75 }
76
77 RUNNER_CHILD_TEST(t08_fail_unknown_exception)
78 {
79     throw(1);
80 }
81
82 RUNNER_CHILD_TEST(t09_fail_you_should_see_text_normal_assert)
83 {
84     RUNNER_ASSERT_MSG(0, "Normal assert");
85 }
86
87 RUNNER_CHILD_TEST(t10_pass)
88 {
89     RUNNER_ASSERT_MSG(1, "Normal assert");
90 }
91