예제 #1
0
파일: test_lispy.py 프로젝트: Ceasar/LisPy
def test_define_procedure(context):
    program = "(begin (define (square x) (* x x)) (square 10))"
    assert interpret(program, context) == 100
예제 #2
0
파일: test_lispy.py 프로젝트: Ceasar/LisPy
def test_evaluate_set():
    assert interpret("(begin (define x 2) (set! x 3) x)") == 3
예제 #3
0
파일: test_lispy.py 프로젝트: Ceasar/LisPy
def test_evaluate_define():
    assert interpret("(begin (define x 2) x)") == 2
예제 #4
0
파일: test_lispy.py 프로젝트: Ceasar/LisPy
def test_evaluate_if_false():
    assert interpret("(if 0 2 3)") == 3
예제 #5
0
파일: test_lispy.py 프로젝트: Ceasar/LisPy
def test_evaluate_if_true():
    assert interpret("(if 1 2 3)") == 2
예제 #6
0
파일: test_lispy.py 프로젝트: Ceasar/LisPy
def test_evaluate_constant_literal():
    assert interpret("12") == 12