Refactor(Tests): Add proper (pp1 tests) unit tests for all logic ADTs
Tests for Positie, Doolhof, Pac-Man, Score, and Tijdslimiet ADTs using check/check-eq?/run-test from (pp1 tests) library. Centralized test runner in alle-testen.rkt with prefix imports. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
30
pacman-project/tests/test-score.rkt
Normal file
30
pacman-project/tests/test-score.rkt
Normal file
@@ -0,0 +1,30 @@
|
||||
#lang r7rs
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Tests: Score ADT ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define-library (pacman-project tests test-score)
|
||||
(import (scheme base)
|
||||
(pp1 tests)
|
||||
(pacman-project adt-score))
|
||||
(export test)
|
||||
|
||||
(begin
|
||||
|
||||
;; Test startscore
|
||||
(define (test-startscore)
|
||||
(define s (maak-score))
|
||||
(check-eq? (s 'punten) 0 "Startscore moet 0 zijn"))
|
||||
|
||||
;; Test score verhoging
|
||||
(define (test-verhoog)
|
||||
(define s (maak-score))
|
||||
((s 'verhoog!))
|
||||
(check-eq? (s 'punten) 10 "Score moet 10 zijn na 1 muntje")
|
||||
((s 'verhoog!))
|
||||
(check-eq? (s 'punten) 20 "Score moet 20 zijn na 2 muntjes"))
|
||||
|
||||
(define (test)
|
||||
(run-test test-startscore "Score: startscore")
|
||||
(run-test test-verhoog "Score: verhoging"))))
|
||||
Reference in New Issue
Block a user