#lang racket
(require "../compile.rkt" "../parse.rkt" a86/interp rackunit)

(define (run e)
  (asm-interp (compile (parse e))))

;; Abscond examples
(check-equal? (run 7) 7)
(check-equal? (run -8) -8)

   examples
(check-equal? (run '(add1 (add1 7))) 9)
(check-equal? (run '(add1 (sub1 7))) 7)

;; Con examples
(check-equal? (run '(if (zero? 0) 1 2)) 1)
(check-equal? (run '(if (zero? 1) 1 2)) 2)
(check-equal? (run '(if (zero? -7) 1 2)) 2)
(check-equal? (run '(if (zero? 0)
                        (if (zero? 1) 1 2)
                        7))
              2)
(check-equal? (run '(if (zero? (if (zero? 0) 1 0))
                        (if (zero? 1) 1 2)
                        7))
              7)

 Abscond examples
 Con examples
#lang racket
(require "../compile.rkt" "../parse.rkt" a86/interp rackunit)

(define (run e)
  (asm-interp (compile (parse e))))

(check-equal? (run 7) 7)
(check-equal? (run -8) -8)

   examples
(check-equal? (run '(add1 (add1 7))) 9)
(check-equal? (run '(add1 (sub1 7))) 7)

(check-equal? (run '(if (zero? 0) 1 2)) 1)
(check-equal? (run '(if (zero? 1) 1 2)) 2)
(check-equal? (run '(if (zero? -7) 1 2)) 2)
(check-equal? (run '(if (zero? 0)
                        (if (zero? 1) 1 2)
                        7))
              2)
(check-equal? (run '(if (zero? (if (zero? 0) 1 0))
                        (if (zero? 1) 1 2)
                        7))
              7)
