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.139 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.138 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.137 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.136 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.135 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.134 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.133 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.132 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.131 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.130 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.129 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.128 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.127 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.126 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.125 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.124 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.123 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.122 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.121 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp
trackler-2.2.1.120 tracks/common-lisp/exercises/robot-name/robot-name-test.lisp