def test_file_strings_is_good(self): expected = [ u'__text', u'__TEXT', u'__cstring', u'__TEXT', u'__jump_table', u'__IMPORT', u'__textcoal_nt', u'__TEXT', u'_main', u'___i686.get_pc_thunk.bx', u'_setlocale', u'_yyparse', u'/sw/src/fink.build/bison-2.3-1002/bison-2.3/lib/', u'main.c', u'gcc2_compiled.', u'main:F(0,2)', u'int:t(0,2)=r(0,2);-2147483648;2147483647;' ] test_file = self.get_test_loc('strings/basic/main.o') result = [s for s in strings.file_strings(test_file) if strings.is_good(s)] assert expected == result
def test_strings_in_fonts(self): expected = self.get_test_loc('strings/font/DarkGardenMK.ttf.results') expected = open(expected, 'rb').read().splitlines() test_file = self.get_test_loc('strings/font/DarkGardenMK.ttf') result = [s for s in strings.file_strings(test_file) if strings.is_good(s)] assert sorted(expected) == sorted(result)
def test_strings_in_obj(self): test_file = self.get_test_loc('strings/obj/test.o') result = [s for s in strings.file_strings(test_file) if strings.is_good(s)] expected = self.get_test_loc('strings/obj/test.o.results') # with open(expected, 'wb') as o: # o.write('\n'.join(result)) expected = open(expected, 'rb').read().splitlines() assert sorted(expected) == sorted(result)
def test_strings_in_fonts(self): expected = self.get_test_loc('strings/font/DarkGardenMK.ttf.results') expected = open(expected, 'rb').read().splitlines() test_file = self.get_test_loc('strings/font/DarkGardenMK.ttf') result = [ s for s in strings.file_strings(test_file) if strings.is_good(s) ] assert sorted(expected) == sorted(result)
def test_is_good(self): assert not strings.is_good('aw w we ww ') assert strings.is_good('ww asww wew wee wew ') assert not strings.is_good('asw wew wee wew ', strings.filter_strict) assert strings.is_good('gnu as') assert strings.is_good('gnu as', strings.filter_strict) assert not strings.is_good('aaqa', strings.filter_strict) assert strings.is_good('aaqa')
def test_strings_in_elf(self): test_file = self.get_test_loc('strings/elf/shash.i686') result = [ s for s in strings.file_strings(test_file) if strings.is_good(s) ] expected = self.get_test_loc('strings/elf/shash.i686.results') # with open(expected, 'wb') as o: # o.write('\n'.join(result)) expected = open(expected, 'rb').read().splitlines() assert sorted(expected) == sorted(result)
def test_file_strings_is_good(self): expected = [ u'__text', u'__TEXT', u'__cstring', u'__TEXT', u'__jump_table', u'__IMPORT', u'__textcoal_nt', u'__TEXT', u'_main', u'___i686.get_pc_thunk.bx', u'_setlocale', u'_yyparse', u'/sw/src/fink.build/bison-2.3-1002/bison-2.3/lib/', u'main.c', u'gcc2_compiled.', u'main:F(0,2)', u'int:t(0,2)=r(0,2);-2147483648;2147483647;' ] test_file = self.get_test_loc('strings/basic/main.o') result = [ s for s in strings.file_strings(test_file) if strings.is_good(s) ] assert expected == result