def fuzz_test_generator(): program = sparse(""" ((~lambda () (~define x 10) (~define y 20) (~define z '(1 2 3)) (~define li '(~ if (nil? '(2)) (add 4 5) (set! x 20))) (~defun add (x y) (+ x y)) (add (~if (< x y) x y) x))) """) env = make_stdenv() env.define('a', sparse('10')) env.define('b', sparse('(4 5 6)')) env.define('c', sparse('(~define t 10)')) env.define('d', sparse('(+ 20 20)')) env.define('e', seval('(~lambda (x) (* x 2))', env)) for i in range(FUZZ_TIMES): yield do_fuzz, random_modify(env, program), env
def sparse_unquote_test(): eq_(sunparse(sparse("`(a ,b)")), '(~ quasiquote (a (unquote b)))')
def sparse_quasiquote_test(): eq_(sunparse(sparse("`(a b)")), '(~ quasiquote (a b))')
def sparse_num_test(): eq_(sparse('5'), SNode('num', 5))
def sparse_sf_test(): eq_(sparse("(~)"), SNode('list', (SNode('sf', '~'),)))
def sparse_quote_list_test(): eq_(sunparse(sparse("'(1 2)")), '(~ quote (1 2))')
def sparse_sunparse_list_test(): eq_(sunparse(sparse('(1 b)')), '(1 b)')
def sparse_id_test(): eq_(sparse('x'), SNode('id', 'x'))
def sparse_sunparse_num_test(): eq_(sunparse(sparse('5')), '5')
def sparse_sunparse_id_test(): eq_(sunparse(sparse('a')), 'a')
def sparse_nested_list_test(): eq_(sparse('(a (b c) d)'), SNode('list', (SNode('id', 'a'), SNode('list', (SNode('id', 'b'), SNode('id', 'c'))), SNode('id', 'd'))))
def sparse_two_element_list_test(): eq_(sparse('(x y)'), SNode('list', (SNode('id', 'x'), SNode('id', 'y'))))
def sparse_empty_list_test(): eq_(sparse('()'), SNode('list', tuple()))
def sparse_dot_test(): eq_(sunparse(sparse("(1 . 2)")), '(1 . 2)')
def sparse_quote_num_test(): eq_(sunparse(sparse("'5")), '(~ quote 5)')
def sparse_split_test(): eq_(sunparse(sparse("`(1 ,@(2))")), '(~ quasiquote (1 (unquote-splice (2))))')
def sparse_quote_id_test(): eq_(sunparse(sparse("'x")), '(~ quote x)')
tar.close() time.sleep(0.05) print(partition.ljust(12) + " : " + partition_file.ljust(20) + " " + addr.strip( "L").ljust(12) + " " + size.strip("L").ljust(12) + " " + "Extracted") """ # Ext4 extracting here """ if partition_file[-4:] == "ext4": print("Converting".ljust(12) + " :", end=" ") path = tar_file[0:6] + "\\extract\\" + partition_file FH = open(path, 'rb') # open file. header_bin = FH.read(28) header = struct.unpack("<I4H4I", header_bin) magic = header[0] if magic == 0xED26FF3A: sparse(partition_file) except KeyError: time.sleep(0.05) print(partition.ljust(12) + " : " + partition_file.ljust(20) + " " + addr.strip( "L").ljust(12) + " " + size.strip("L").ljust(12) + " " + "Not Found") else: print(partition.ljust(12) + " : " + partition_file.ljust(20) + " " + addr.strip("L").ljust(12) + " " + size.strip("L").ljust(12)) else: print("END") break i = i + 264 # 84 bytes each block of pit else: "This .pit file seems wrong\n" \ "Please send us to analyze"
def seval(string, env=None): """Evaluate a string and return the result.""" if env is None: env = SEnvironment() return seval_tree(sparse(string), env)