예제 #1
0
 def test_strcasecmp_m(self):
     # A, B, strcasecmp(A, B)
     cases = [
         ('hello', 'hello', 0),
         ('hello', 'goodbye', +1),
         ('goodbye', 'hello', -1),
         ('hell', 'hello', -1),
         ('', '', 0),
         ('a', '', +1),
         ('', 'a', -1),
         ('a', 'A', 0),
         ('aa', 'aA', 0),
         ('Aa', 'aa', 0),
         ('longstring ' * 100, 'longstring ' * 100, 0),
         ('longstring ' * 100, 'longstring ' * 100 + 'a', -1),
         ('longstring ' * 100 + 'a', 'longstring ' * 100, +1),
         (KATAKANA_LETTER_A, KATAKANA_LETTER_A, 0),
         (KATAKANA_LETTER_A, 'a', 1),
     ]
     for a, b, expect in cases:
         self.assertEqual(signum(strcasecmp_m(a, b)), expect)
예제 #2
0
파일: strings.py 프로젝트: srimalik/samba
 def test_strcasecmp_m(self):
     # A, B, strcasecmp(A, B)
     cases = [('hello', 'hello', 0),
              ('hello', 'goodbye', +1),
              ('goodbye', 'hello', -1),
              ('hell', 'hello', -1),
              ('', '', 0),
              ('a', '', +1),
              ('', 'a', -1),
              ('a', 'A', 0),
              ('aa', 'aA', 0),
              ('Aa', 'aa', 0),
              ('longstring ' * 100, 'longstring ' * 100, 0),
              ('longstring ' * 100, 'longstring ' * 100 + 'a', -1),
              ('longstring ' * 100 + 'a', 'longstring ' * 100, +1),
              (KATAKANA_LETTER_A, KATAKANA_LETTER_A, 0),
              (KATAKANA_LETTER_A, 'a', 1),
              ]
     for a, b, expect in cases:
         self.assertEquals(signum(strcasecmp_m(a.encode('utf-8'),
                                               b.encode('utf-8'))),
                           expect)