blob: 0df0a49116bfe509c2f8eb0a380ec50af87e31be [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001'''
2
3 TestON is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 2 of the License, or
6 (at your option) any later version.
7
8 TestON is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
Jon Hall4ba53f02015-07-29 13:07:41 -070014 along with TestON. If not, see <http://www.gnu.org/licenses/>.
adminbae64d82013-08-01 10:50:15 -070015
16
17'''
18class Assert :
19
20 def __init__(self) :
21 self.default = ''
22
23 def CASE1(self,main) :
24
Jon Hall4ba53f02015-07-29 13:07:41 -070025
adminbae64d82013-08-01 10:50:15 -070026 main.case("Using assert to verify the result")
27 main.step("Using assert_equal to verify the result is equivalent or not")
28 expect = main.TRUE
29 actual = main.TRUE
30 main.log.warn(main.response_parser('<real></real><imag>2</imag><__complex__>true</__complex__>', "json"))
31 utilities.assert_equals(expect=expect,actual=actual,onpass="expect is equal to actual",onfail="expect is not equal to actual")
Jon Hall4ba53f02015-07-29 13:07:41 -070032
adminbae64d82013-08-01 10:50:15 -070033 main.step("Using assert_matches to verify the result matches or not")
34 expect = "Res(.*)"
35 actual = "Result"
36 utilities.assert_matches(expect=expect,actual=actual,onpass="expect is macthes to actual",onfail="expect is not matches to actual")
Jon Hall4ba53f02015-07-29 13:07:41 -070037
adminbae64d82013-08-01 10:50:15 -070038 main.step("Using assert_greater to verify the result greater or not")
39 expect = 10
40 actual = 5
41 utilities.assert_greater(expect=actual,actual=expect,onpass="expect is greater than the actual",onfail="expect is not greater than the actual")
Jon Hall4ba53f02015-07-29 13:07:41 -070042
adminbae64d82013-08-01 10:50:15 -070043 main.step("Using assert_lesser to verify the result lesser or not")
44 expect = 5
45 actual = 10
46 utilities.assert_lesser(expect=actual,actual=expect,onpass="expect is lesser than the actual",onfail="expect is not lesser than the actual")