Beispiel #1
0
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
Beispiel #2
0
def sparse_unquote_test():
    eq_(sunparse(sparse("`(a ,b)")), '(~ quasiquote (a (unquote b)))')
Beispiel #3
0
def sparse_quasiquote_test():
    eq_(sunparse(sparse("`(a b)")), '(~ quasiquote (a b))')
Beispiel #4
0
def sparse_num_test():
    eq_(sparse('5'), SNode('num', 5))
Beispiel #5
0
def sparse_sf_test():
    eq_(sparse("(~)"), SNode('list', (SNode('sf', '~'),)))
Beispiel #6
0
def sparse_quote_list_test():
    eq_(sunparse(sparse("'(1 2)")), '(~ quote (1 2))')
Beispiel #7
0
def sparse_sunparse_list_test():
    eq_(sunparse(sparse('(1 b)')), '(1 b)')
Beispiel #8
0
def sparse_id_test():
    eq_(sparse('x'), SNode('id', 'x'))
Beispiel #9
0
def sparse_sunparse_num_test():
    eq_(sunparse(sparse('5')), '5')
Beispiel #10
0
def sparse_sunparse_id_test():
    eq_(sunparse(sparse('a')), 'a')
Beispiel #11
0
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'))))
Beispiel #12
0
def sparse_two_element_list_test():
    eq_(sparse('(x y)'), SNode('list', (SNode('id', 'x'), SNode('id', 'y'))))
Beispiel #13
0
def sparse_empty_list_test():
    eq_(sparse('()'), SNode('list', tuple()))
Beispiel #14
0
def sparse_dot_test():
    eq_(sunparse(sparse("(1 . 2)")), '(1 . 2)')
Beispiel #15
0
def sparse_quote_num_test():
    eq_(sunparse(sparse("'5")), '(~ quote 5)')
Beispiel #16
0
def sparse_split_test():
    eq_(sunparse(sparse("`(1 ,@(2))")), '(~ quasiquote (1 (unquote-splice (2))))')
Beispiel #17
0
def sparse_quote_id_test():
    eq_(sunparse(sparse("'x")), '(~ quote x)')
Beispiel #18
0
                            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"
Beispiel #19
0
def seval(string, env=None):
    """Evaluate a string and return the result."""
    if env is None:
        env = SEnvironment()
    return seval_tree(sparse(string), env)