diff options
author | fab <fabrice.leal.ch@gmail.com> | 2018-12-12 21:29:05 +0000 |
---|---|---|
committer | fab <fabrice.leal.ch@gmail.com> | 2018-12-12 21:29:05 +0000 |
commit | db41db44f8693d6d1b740eb0b55ef84a4245b576 (patch) | |
tree | eee33ff14e8eb7d025fb98faa71c7d08ad9e1ea6 /tests | |
parent | e452bb052b6c1afbaaa72efb653ea31561333866 (diff) |
tidy unit tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/utf8.py | 112 | ||||
-rw-r--r-- | tests/utf8.ur | 20 |
2 files changed, 66 insertions, 66 deletions
diff --git a/tests/utf8.py b/tests/utf8.py index ac8df5c3..6036fa12 100644 --- a/tests/utf8.py +++ b/tests/utf8.py @@ -2,109 +2,119 @@ import unittest import base class Suite(base.Base): - def test_99(self): + + def no_falses(self, name): + self.start('Utf8/' + name) + + elems = self.driver.find_elements_by_xpath('//pre') + + self.assertNotEqual(0, len(elems)) + for e in elems: + self.assertEqual("True", e.text) + + def test_1(self): """Test case: substring (1)""" - self.start('Utf8/substrings') - - def test_98(self): + self.no_falses('substrings') + + def test_2(self): """Test case: strlen (2)""" - self.start('Utf8/strlens') + self.no_falses('strlens') - def test_97(self): + def test_3(self): """Test case: strlenGe (3)""" - self.start('Utf8/strlenGens') + self.no_falses('strlenGens') - def test_96(self): + def test_4(self): """Test case: strcat (4)""" - self.start('Utf8/strcats') + self.no_falses('strcats') - def test_95(self): + def test_5(self): """Test case: strsub (5)""" - self.start('Utf8/strsubs') + self.no_falses('strsubs') - def test_94(self): + def test_6(self): """Test case: strsuffix (6)""" - self.start('Utf8/strsuffixs') + self.no_falses('strsuffixs') - def test_93(self): + def test_7(self): """Test case: strchr (7)""" - self.start('Utf8/strchrs') + self.no_falses('strchrs') - def test_92(self): + def test_8(self): """Test case: strindex (8)""" - self.start('Utf8/strindexs') + self.no_falses('strindexs') - def test_91(self): + def test_9(self): """Test case: strindex (9)""" - self.start('Utf8/strsindexs') + self.no_falses('strsindexs') - def test_90(self): + def test_10(self): """Test case: strcspn (10)""" - self.start('Utf8/strcspns') + self.no_falses('strcspns') - def test_89(self): + def test_11(self): """Test case: str1 (11)""" - self.start('Utf8/str1s') + self.no_falses('str1s') - def test_88(self): + def test_12(self): """Test case: isalnum (12)""" - self.start('Utf8/isalnums') + self.no_falses('isalnums') def test_13(self): """Test case: isalpha (13)""" - self.start('Utf8/isalphas') + self.no_falses('isalphas') def test_14(self): """Test case: isblank (14)""" - self.start('Utf8/isblanks') + self.no_falses('isblanks') def test_15(self): """Test case: iscntrl (15)""" - self.start('Utf8/iscntrls') + self.no_falses('iscntrls') def test_16(self): """Test case: isdigit (16)""" - self.start('Utf8/isdigits') + self.no_falses('isdigits') def test_17(self): """Test case: isgraph (17)""" - self.start('Utf8/isgraphs') + self.no_falses('isgraphs') def test_18(self): """Test case: islower (18)""" - self.start('Utf8/islowers') + self.no_falses('islowers') def test_19(self): """Test case: isprint (19)""" - self.start('Utf8/isprints') + self.no_falses('isprints') def test_20(self): """Test case: ispunct (20)""" - self.start('Utf8/ispuncts') + self.no_falses('ispuncts') def test_21(self): """Test case: isspace (21)""" - self.start('Utf8/isspaces') + self.no_falses('isspaces') def test_22(self): """Test case: isupper (22)""" - self.start('Utf8/isuppers') + self.no_falses('isuppers') def test_23(self): """Test case: isxdigit (23)""" - self.start('Utf8/isxdigits') + self.no_falses('isxdigits') def test_24(self): """Test case: toupper (24)""" - self.start('Utf8/touppers') + self.no_falses('touppers') def test_25(self): """Test case: ord (25)""" - self.start('Utf8/ord_and_chrs') + self.no_falses('ord_and_chrs') def test_26 (self): """Test case: test_db (26) """ - self.start('Utf8/test_db') + self.no_falses('test_db') def full_test (self, name): @@ -117,46 +127,48 @@ class Suite(base.Base): i = i + gap - def test_1 (self): + def test_89 (self): """Test case: ftTolower """ self.full_test("ftTolower") - def test_2 (self): + def test_90 (self): """Test case: ftToupper """ self.full_test("ftToupper") - def test_3 (self): + def test_91 (self): """Test case: ftIsalpha """ self.full_test("ftIsalpha") - def test_4 (self): + def test_92 (self): """Test case: ftIsdigit """ self.full_test("ftIsdigit") - def test_5 (self): + def test_93 (self): """Test case: ftIsalnum """ self.full_test("ftIsalnum") - def test_6 (self): + def test_94 (self): """Test case: ftIsspace """ self.full_test("ftIsspace") - def test_7 (self): + def test_95 (self): """Test case: ftIsblank """ self.full_test("ftIsblank") - def test_8 (self): + def test_96 (self): """Test case: ftIsprint """ self.full_test("ftIsprint") - def test_9 (self): + def test_97 (self): """Test case: ftIsxdigit """ self.full_test("ftIsxdigit") - def test_10 (self): + def test_98 (self): """Test case: ftIsupper """ self.full_test("ftIsupper") - def test_11 (self): + def test_99 (self): """Test case: ftIslower """ self.full_test("ftIslower") + ''' + ''' diff --git a/tests/utf8.ur b/tests/utf8.ur index 777bb141..4a89c22b 100644 --- a/tests/utf8.ur +++ b/tests/utf8.ur @@ -11,32 +11,20 @@ fun from_m_upto_n f m n = fun test_fn_both_sides [a ::: Type] (_ : eq a) (_ : show a) (f : unit -> a) (expected : a) (testname : string) : xbody = <xml> <p>Server side test: {[testname]}</p> - <pre>{[assert (f () = expected) "False" testname "True" ]}</pre> - <active code={let - val computed = f () - val msgErr = "False " ^ testname ^ ": expected " ^ (show expected) ^ " but is " ^ (show computed) - val r = assert (computed = expected) msgErr testname "True" - in - return <xml><p>Client side test: {[testname]}</p><pre>{[r]}</pre></xml> - end}> + <pre>{[show (f () = expected)]}</pre> + <active code={return <xml><p>Client side test: {[testname]}</p><pre>{[show (f () = expected)]}</pre></xml>}> </active> </xml> fun test_fn_sside [a ::: Type] (_ : eq a) (_ : show a) (f : unit -> a) (expected : a) (testname : string) : xbody = <xml> <p>Server side test: {[testname]}</p> - <pre>{[assert (f () = expected) "False" testname "True" ]}</pre> + <pre>{[show (f () = expected)]}</pre> </xml> fun test_fn_cside [a ::: Type] (_ : eq a) (_ : show a) (f : unit -> a) (expected : a) (testname : string) : xbody = <xml> - <active code={let - val computed = f () - val msgErr = "False " ^ testname ^ ": expected " ^ (show expected) ^ " but is " ^ (show computed) - val r = assert (computed = expected) msgErr testname "True" - in - return <xml><p>Client side test: {[testname]}</p><pre>{[r]}</pre></xml> - end}> + <active code={return <xml><p>Client side test: {[testname]}</p><pre>{[show (f () = expected)]}</pre></xml>}> </active> </xml> |