CompareStream correction.
[integration/test.git] / csit / libraries / CompareStream.robot
1 *** Settings ***
2 Documentation     This Resource contains list of Keywords Set_Variable_If_At_Least*, Set_Variable_If_At_Most,
3 ...               Run_Keyword_If_At_Least*, Run_Keyword_If_At_Most*,
4 ...               Run_Keyword_If_More_Than*, Run_Keyword_If_Less_Than*,
5 ...               for comparison ${ODL_STREAM} to the given ${lower_bound},
6 ...               in order to replace ad-hoc conditional execution in suites.
7
8 *** Variables ***
9 &{Stream_dict}    hydrogen=${1}    stable-helium=${2}    stable-lithium=${3}    beryllium=${4}    boron=${5}    carbon=${6}    nitrogen=${7}
10
11 *** Keywords ***
12 Set_Variable_If_At_Least
13     [Arguments]    ${lower_bound}    ${value_if_true}    ${value_if_false}
14     [Documentation]    Compare ${lower_bound} to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least ${lower_bound},
15     ...    return ${value_if_false} otherwise.
16     BuiltIn.Run_Keyword_And_Return    BuiltIn.Set_Variable_If    &{Stream_dict}[${ODL_STREAM}] >= &{Stream_dict}[${lower_bound}]    ${value_if_true}    ${value_if_false}
17
18 Set_Variable_If_At_Most
19     [Arguments]    ${upper_bound}    ${value_if_true}    ${value_if_false}
20     [Documentation]    Compare ${upper_bound} to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most ${upper_bound},
21     ...    return ${value_if_false} otherwise.
22     BuiltIn.Run_Keyword_And_Return    BuiltIn.Set_Variable_If    &{Stream_dict}[${ODL_STREAM}] <= &{Stream_dict}[${upper_bound}]    ${value_if_true}    ${value_if_false}
23
24 Set_Variable_If_At_Least_Helium
25     [Arguments]    ${value_if_true}    ${value_if_false}
26     [Documentation]    Compare stable-helium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least stable-helium,
27     ...    return ${value_if_false} otherwise.
28     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Least    stable-helium    ${value_if_true}    ${value_if_false}
29
30 Set_Variable_If_At_Least_Lithium
31     [Arguments]    ${value_if_true}    ${value_if_false}
32     [Documentation]    Compare stable-lithium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least stable-lithium,
33     ...    return ${value_if_false} otherwise.
34     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Least    stable-lithium    ${value_if_true}    ${value_if_false}
35
36 Set_Variable_If_At_Least_Beryllium
37     [Arguments]    ${value_if_true}    ${value_if_false}
38     [Documentation]    Compare beryllium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least beryllium,
39     ...    return ${value_if_false} otherwise.
40     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Least    beryllium    ${value_if_true}    ${value_if_false}
41
42 Set_Variable_If_At_Least_Boron
43     [Arguments]    ${value_if_true}    ${value_if_false}
44     [Documentation]    Compare boron to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least boron,
45     ...    return ${value_if_false} otherwise.
46     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Least    boron    ${value_if_true}    ${value_if_false}
47
48 Set_Variable_If_At_Least_Carbon
49     [Arguments]    ${value_if_true}    ${value_if_false}
50     [Documentation]    Compare carbon to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at least carbon,
51     ...    return ${value_if_false} otherwise.
52     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Least    carbon    ${value_if_true}    ${value_if_false}
53
54 Set_Variable_If_At_Most_Helium
55     [Arguments]    ${value_if_true}    ${value_if_false}
56     [Documentation]    Compare stable-helium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most stable-helium,
57     ...    return ${value_if_false} otherwise.
58     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Most    stable-helium    ${value_if_true}    ${value_if_false}
59
60 Set_Variable_If_At_Most_Lithium
61     [Arguments]    ${value_if_true}    ${value_if_false}
62     [Documentation]    Compare stable-lithium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most stable-lithium,
63     ...    return ${value_if_false} otherwise.
64     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Most    stable-lithium    ${value_if_true}    ${value_if_false}
65
66 Set_Variable_If_At_Most_Beryllium
67     [Arguments]    ${value_if_true}    ${value_if_false}
68     [Documentation]    Compare beryllium to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most beryllium,
69     ...    return ${value_if_false} otherwise.
70     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Most    beryllium    ${value_if_true}    ${value_if_false}
71
72 Set_Variable_If_At_Most_Boron
73     [Arguments]    ${value_if_true}    ${value_if_false}
74     [Documentation]    Compare boron to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most boron,
75     ...    return ${value_if_false} otherwise.
76     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Most    boron    ${value_if_true}    ${value_if_false}
77
78 Set_Variable_If_At_Most_Carbon
79     [Arguments]    ${value_if_true}    ${value_if_false}
80     [Documentation]    Compare carbon to ${ODL_STREAM} and return ${value_if_true} if ${ODL_STREAM} is at most carbon,
81     ...    return ${value_if_false} otherwise.
82     BuiltIn.Run_Keyword_And_Return    Set_Variable_If_At_Most    carbon    ${value_if_true}    ${value_if_false}
83
84 Run_Keyword_If_At_Least
85     [Arguments]    ${lower_bound}    ${kw_name}    @{varargs}    &{kwargs}
86     [Documentation]    Compare ${lower_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is at least ${lower_bound},
87     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
88     BuiltIn.Run_Keyword_And_Return_If    &{Stream_dict}[${ODL_STREAM}] >= &{Stream_dict}[${lower_bound}]    ${kw_name}    @{varargs}    &{kwargs}
89
90 Run_Keyword_If_At_Most
91     [Arguments]    ${upper_bound}    ${kw_name}    @{varargs}    &{kwargs}
92     [Documentation]    Compare ${upper_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is at most ${upper_bound},
93     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
94     BuiltIn.Run_Keyword_And_Return_If    &{Stream_dict}[${ODL_STREAM}] <= &{Stream_dict}[${upper_bound}]    ${kw_name}    @{varargs}    &{kwargs}
95
96 Run_Keyword_If_More_Than
97     [Arguments]    ${lower_bound}    ${kw_name}    @{varargs}    &{kwargs}
98     [Documentation]    Compare ${lower_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is more than ${lower_bound},
99     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
100     BuiltIn.Run_Keyword_And_Return_If    &{Stream_dict}[${ODL_STREAM}] > &{Stream_dict}[${lower_bound}]    ${kw_name}    @{varargs}    &{kwargs}
101
102 Run_Keyword_If_Less_Than
103     [Arguments]    ${lower_bound}    ${kw_name}    @{varargs}    &{kwargs}
104     [Documentation]    Compare ${lower_bound} to ${ODL_STREAM} and in case ${ODL_STREAM} is less than ${lower_bound},
105     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
106     BuiltIn.Run_Keyword_And_Return_If    &{Stream_dict}[${ODL_STREAM}] < &{Stream_dict}[${lower_bound}]    ${kw_name}    @{varargs}    &{kwargs}
107
108 Run_Keyword_If_At_Least_Helium
109     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
110     [Documentation]    Compare stable-helium to ${ODL_STREAM} and in case ${ODL_STREAM} is at least stable-helium,
111     ...    run ${kw_name} @{varargs} &{kwargs} and return its value
112     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Least    stable-helium    ${kw_name}    @{varargs}    &{kwargs}
113
114 Run_Keyword_If_At_Least_Lithium
115     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
116     [Documentation]    Compare stable-lithium to ${ODL_STREAM} and in case ${ODL_STREAM} is at least stable-lithium,
117     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
118     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Least    stable-lithium    ${kw_name}    @{varargs}    &{kwargs}
119
120 Run_Keyword_If_At_Least_Beryllium
121     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
122     [Documentation]    Compare beryllium to ${ODL_STREAM} and in case ${ODL_STREAM} is at least beryllium,
123     ...    run ${kw_name} @{varargs} &{kwargs} and return its value
124     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Least    beryllium    ${kw_name}    @{varargs}    &{kwargs}
125
126 Run_Keyword_If_At_Least_Boron
127     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
128     [Documentation]    Compare boron to ${ODL_STREAM} and in case ${ODL_STREAM} is at least boron,
129     ...    run ${kw_name} @{varargs} &{kwargs} and return its value
130     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Least    boron    ${kw_name}    @{varargs}    &{kwargs}
131
132 Run_Keyword_If_At_Least_Carbon
133     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
134     [Documentation]    Compare carbon to ${ODL_STREAM} and in case ${ODL_STREAM} is at least carbon,
135     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
136     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Least    carbon    ${kw_name}    @{varargs}    &{kwargs}
137
138 Run_Keyword_If_At_Most_Helium
139     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
140     [Documentation]    Compare stable-helium to ${ODL_STREAM} and in case ${ODL_STREAM} is at most stable-helium,
141     ...    run ${kw_name} @{varargs} &{kwargs} and return its value
142     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Most    stable-helium    ${kw_name}    @{varargs}    &{kwargs}
143
144 Run_Keyword_If_At_Most_Lithium
145     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
146     [Documentation]    Compare stable-lithium to ${ODL_STREAM} and in case ${ODL_STREAM} is at most stable-lithium,
147     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
148     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Most    stable-lithium    ${kw_name}    @{varargs}    &{kwargs}
149
150 Run_Keyword_If_At_Most_Beryllium
151     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
152     [Documentation]    Compare beryllium to ${ODL_STREAM} and in case ${ODL_STREAM} is at most beryllium,
153     ...    run ${kw_name} @{varargs} &{kwargs} and return its value
154     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Most    beryllium    ${kw_name}    @{varargs}    &{kwargs}
155
156 Run_Keyword_If_At_Most_Boron
157     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
158     [Documentation]    Compare boron to ${ODL_STREAM} and in case ${ODL_STREAM} is at most boron,
159     ...    run ${kw_name} @{varargs} &{kwargs} and return its value
160     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Most    boron    ${kw_name}    @{varargs}    &{kwargs}
161
162 Run_Keyword_If_At_Most_Carbon
163     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
164     [Documentation]    Compare carbon to ${ODL_STREAM} and in case ${ODL_STREAM} is at most carbon,
165     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
166     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_At_Most    carbon    ${kw_name}    @{varargs}    &{kwargs}
167
168 Run_Keyword_If_More_Than_Helium
169     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
170     [Documentation]    Compare stable-helium to ${ODL_STREAM} and in case ${ODL_STREAM} is more than stable-helium,
171     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
172     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_More_Than    stable-helium    ${kw_name}    @{varargs}    &{kwargs}
173
174 Run_Keyword_If_Less_Than_Helium
175     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
176     [Documentation]    Compare stable-helium to ${ODL_STREAM} and in case ${ODL_STREAM} is less than stable-helium,
177     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
178     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_Less_Than    stable-helium    ${kw_name}    @{varargs}    &{kwargs}
179
180 Run_Keyword_If_More_Than_Lithium
181     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
182     [Documentation]    Compare stable-lithium to ${ODL_STREAM} and in case ${ODL_STREAM} is more than stable-lithium,
183     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
184     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_More_Than    stable-lithium    ${kw_name}    @{varargs}    &{kwargs}
185
186 Run_Keyword_If_Less_Than_Lithium
187     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
188     [Documentation]    Compare stable-lithium to ${ODL_STREAM} and in case ${ODL_STREAM} is less than stable-lithium,
189     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
190     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_Less_Than    stable-lithium    ${kw_name}    @{varargs}    &{kwargs}
191
192 Run_Keyword_If_More_Than_Beryllium
193     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
194     [Documentation]    Compare beryllium to ${ODL_STREAM} and in case ${ODL_STREAM} is more than beryllium,
195     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
196     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_More_Than    beryllium    ${kw_name}    @{varargs}    &{kwargs}
197
198 Run_Keyword_If_Less_Than_Beryllium
199     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
200     [Documentation]    Compare beryllium to ${ODL_STREAM} and in case ${ODL_STREAM} is less than beryllium,
201     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
202     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_Less_Than    beryllium    ${kw_name}    @{varargs}    &{kwargs}
203
204 Run_Keyword_If_More_Than_Boron
205     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
206     [Documentation]    Compare boron to ${ODL_STREAM} and in case ${ODL_STREAM} is more than boron,
207     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
208     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_More_Than    boron    ${kw_name}    @{varargs}    &{kwargs}
209
210 Run_Keyword_If_Less_Than_Boron
211     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
212     [Documentation]    Compare boron to ${ODL_STREAM} and in case ${ODL_STREAM} is less than boron,
213     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
214     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_Less_Than    boron    ${kw_name}    @{varargs}    &{kwargs}
215
216 Run_Keyword_If_More_Than_Carbon
217     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
218     [Documentation]    Compare carbon to ${ODL_STREAM} and in case ${ODL_STREAM} is more than carbon,
219     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
220     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_More_Than    carbon    ${kw_name}    @{varargs}    &{kwargs}
221
222 Run_Keyword_If_Less_Than_Carbon
223     [Arguments]    ${kw_name}    @{varargs}    &{kwargs}
224     [Documentation]    Compare carbon to ${ODL_STREAM} and in case ${ODL_STREAM} is less than carbon,
225     ...    run ${kw_name} @{varargs} &{kwargs} and return its value.
226     BuiltIn.Run_Keyword_And_Return    Run_Keyword_If_Less_Than    carbon    ${kw_name}    @{varargs}    &{kwargs}