Sha256: dda796d5059df225b49ba07cfbcb9ac539d1980654495ab5cc963c08f579a308

Contents?: true

Size: 1.18 KB

Versions: 290

Compression:

Stored size: 1.18 KB

Contents

(ql:quickload "lisp-unit")
#-xlisp-test (load "robot")

(defpackage #:robot-name-test
  (:use #:common-lisp #:lisp-unit))

(in-package #:robot-name-test)

(defun is-upper-alpha-p (c) (char<= #\A c #\Z))
(defun is-digit-p (c) (char-not-greaterp #\0 c #\9))

(defparameter *robbie* (robot:build-robot))
(defparameter *clutz* (robot:build-robot))

(define-test name-matches-expected-pattern
  (let ((name (robot:robot-name *robbie*)))
    (assert-true (= (length name) 5))
    (assert-true (every #'is-upper-alpha-p (subseq name 0 2)))
    (assert-true (every #'is-digit-p (subseq name 2 5)))))

(define-test name-is-persistent
  (assert-equal (robot:robot-name *robbie*) (robot:robot-name *robbie*)))

(define-test different-robots-have-different-names
  (assert-equality (complement #'equal)
      (robot:robot-name *clutz*)
      (robot:robot-name *robbie*)))

(define-test name-can-be-reset
  (let* ((robot (robot:build-robot))
         (original-name (robot:robot-name robot)))
    (robot:reset-name robot)
    (assert-equality (complement #'equal)
        (robot:robot-name robot)
        original-name)))

#-xlisp-test
(let ((*print-errors* t)
      (*print-failures* t))
  (run-tests :all :robot-name-test))

Version data entries

290 entries across 290 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.179 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.178 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.177 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.176 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.175 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.174 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.173 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.172 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.171 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.170 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.169 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.167 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.166 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.165 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.164 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.163 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.162 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.161 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.160 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp