1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2009-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20-module(io_test_SUITE). 21 22-compile(export_all). 23 24-include_lib("common_test/include/ct.hrl"). 25 26%%-------------------------------------------------------------------- 27%% @spec suite() -> Info 28%% Info = [tuple()] 29%% @end 30%%-------------------------------------------------------------------- 31suite() -> 32 [{timetrap,{seconds,10}}]. 33 34%%-------------------------------------------------------------------- 35%% @spec init_per_suite(Config0) -> 36%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} 37%% Config0 = Config1 = [tuple()] 38%% Reason = term() 39%% @end 40%%-------------------------------------------------------------------- 41init_per_suite(Config) -> 42 Config. 43 44%%-------------------------------------------------------------------- 45%% @spec end_per_suite(Config0) -> void() | {save_config,Config1} 46%% Config0 = Config1 = [tuple()] 47%% @end 48%%-------------------------------------------------------------------- 49end_per_suite(_Config) -> 50 ok. 51 52%%-------------------------------------------------------------------- 53%% @spec init_per_group(GroupName, Config0) -> 54%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} 55%% GroupName = atom() 56%% Config0 = Config1 = [tuple()] 57%% Reason = term() 58%% @end 59%%-------------------------------------------------------------------- 60init_per_group(_GroupName, Config) -> 61 Config. 62 63%%-------------------------------------------------------------------- 64%% @spec end_per_group(GroupName, Config0) -> 65%% void() | {save_config,Config1} 66%% GroupName = atom() 67%% Config0 = Config1 = [tuple()] 68%% @end 69%%-------------------------------------------------------------------- 70end_per_group(_GroupName, _Config) -> 71 ok. 72 73%%-------------------------------------------------------------------- 74%% @spec init_per_testcase(TestCase, Config0) -> 75%% Config1 | {skip,Reason} | {skip_and_save,Reason,Config1} 76%% TestCase = atom() 77%% Config0 = Config1 = [tuple()] 78%% Reason = term() 79%% @end 80%%-------------------------------------------------------------------- 81init_per_testcase(_TestCase, Config) -> 82 Config. 83 84%%-------------------------------------------------------------------- 85%% @spec end_per_testcase(TestCase, Config0) -> 86%% void() | {save_config,Config1} | {fail,Reason} 87%% TestCase = atom() 88%% Config0 = Config1 = [tuple()] 89%% Reason = term() 90%% @end 91%%-------------------------------------------------------------------- 92end_per_testcase(_TestCase, _Config) -> 93 ok. 94 95%%-------------------------------------------------------------------- 96%% @spec groups() -> [Group] 97%% Group = {GroupName,Properties,GroupsAndTestCases} 98%% GroupName = atom() 99%% Properties = [parallel | sequence | Shuffle | {RepeatType,N}] 100%% GroupsAndTestCases = [Group | {group,GroupName} | TestCase] 101%% TestCase = atom() 102%% Shuffle = shuffle | {shuffle,{integer(),integer(),integer()}} 103%% RepeatType = repeat | repeat_until_all_ok | repeat_until_all_fail | 104%% repeat_until_any_ok | repeat_until_any_fail 105%% N = integer() | forever 106%% @end 107%%-------------------------------------------------------------------- 108groups() -> 109 [{g1, [parallel], [tc1,tc2,tc3,{group,g2}]}, 110 {g2, [parallel], [tc1,tc2,tc3]}]. 111 112%%-------------------------------------------------------------------- 113%% @spec all() -> GroupsAndTestCases | {skip,Reason} 114%% GroupsAndTestCases = [{group,GroupName} | TestCase] 115%% GroupName = atom() 116%% TestCase = atom() 117%% Reason = term() 118%% @end 119%%-------------------------------------------------------------------- 120all() -> 121 [tc1,tc2,tc3,{group,g1}]. 122 123tc1(_C) -> 124 io:format("This is an io:format(~p)~n", [[]]), 125 ct:log("ct:log(default)", []), 126 ct:log(?STD_IMPORTANCE, "ct:log(default,~p)", [?STD_IMPORTANCE]), 127 ct:log(error, "ct:log(error)", []), 128 ct:log(error, ?STD_IMPORTANCE, "ct:log(error,~p)", [?STD_IMPORTANCE]), 129 ct:log(1, "ct:log(default,~p)", [1]), 130 ct:log(error, 1, "ct:log(error,~p)", [1]), 131 ct:log(99, "ct:log(default,~p)", [99]), 132 ct:log(error, 99, "ct:log(error,~p)", [99]), 133 ok. 134 135tc2(_C) -> 136 io:format("This is an io:format(~p)~n", [[]]), 137 ct:pal("ct:pal(default)", []), 138 ct:pal(?STD_IMPORTANCE, "ct:pal(default,~p)", [?STD_IMPORTANCE]), 139 ct:pal(error, "ct:pal(error)", []), 140 ct:pal(error, ?STD_IMPORTANCE, "ct:pal(error,~p)", [?STD_IMPORTANCE]), 141 ct:pal(1, "ct:pal(default,~p)", [1]), 142 ct:pal(error, 1, "ct:pal(error,~p)", [1]), 143 ct:pal(99, "ct:pal(default,~p)", [99]), 144 ct:pal(error, 99, "ct:pal(error,~p)", [99]), 145 ok. 146 147tc3(_C) -> 148 io:format("This is an io:format(~p)~n", [[]]), 149 ct:print("ct:print(default)", []), 150 ct:print(?STD_IMPORTANCE, "ct:print(default,~p)", [?STD_IMPORTANCE]), 151 ct:print(error, "ct:print(error)", []), 152 ct:print(error, ?STD_IMPORTANCE, "ct:print(error,~p)", [?STD_IMPORTANCE]), 153 ct:print(1, "ct:print(default,~p)", [1]), 154 ct:print(error, 1, "ct:print(error,~p)", [1]), 155 ct:print(99, "ct:print(default,~p)", [99]), 156 ct:print(error, 99, "ct:print(error,~p)", [99]), 157 ok. 158