#! /bin/sh
#lang scheme
(require "bfs.ss"
(planet schematics/schemeunit:3)
(planet schematics/schemeunit:3/text-ui))
(define nodes-equal? eq?)
(define (node-neighbors n)
(cond
((assoc n '((start a b)
(a start c)
(b start c e)
(c a b e)
(e b c d f)
(d e)
(f e goal)
(goal f)
(outlier)
(cycle-a cycle-b)
(cycle-b cycle-a)
))
=> cdr)
(else
(error 'node-neighbors "Unknown node ~s" n))))
(define (main . args)
(exit
(run-tests
(test-suite
"The one and only suite"
(check-not-false (bfs 'start 'goal nodes-equal? node-neighbors))
(check-not-false (bfs 'goal 'start nodes-equal? node-neighbors))
(check-false (bfs 'outlier 'goal nodes-equal? node-neighbors))
(check-false (bfs 'cycle-a 'goal nodes-equal? node-neighbors))
(check-false (bfs 'start 'goal nodes-equal? node-neighbors 3))
(check-not-false (bfs 'start 'goal nodes-equal? node-neighbors 4))))))
(provide main)