Add some unit test cases

This commit is contained in:
Yiyun Liu 2025-04-29 14:27:22 -04:00
parent a9c7c078f7
commit 4a38f95cab
2 changed files with 42 additions and 16 deletions

11
nbe-test.rkt Normal file
View file

@ -0,0 +1,11 @@
#lang racket
(require rackunit "nbe.rkt")
(define tm-id '(λ (var 0)))
(define tm-fst '(λ (λ (var 1))))
(define tm-snd '(λ (λ (var 0))))
(define tm-pair '(λ (λ (λ (app (app (var 0) (var 2)) (var 1))))))
(check-equal? (normalize `(app ,tm-id ,tm-id)) tm-id)
(check-equal? (normalize `(app (app (app ,tm-pair ,tm-id) ,tm-fst) ,tm-snd)) tm-fst)
(check-equal? (normalize `(app (app (app ,tm-pair ,tm-id) ,tm-fst) ,tm-fst)) tm-id)