Sha256: 020ed3ea089cfbbf98a8e288f6e8f88cfadd92d4d2ad6a14e29a760214eb7dd8

Contents?: true

Size: 1.25 KB

Versions: 396

Compression:

Stored size: 1.25 KB

Contents

;; Load SRFI-64 lightweight testing specification
(use-modules (srfi srfi-64))

;; Suppress log file output. To write logs, comment out the following line:
(module-define! (resolve-module '(srfi srfi-64)) 'test-log-to-file #f)

;; Require module
(add-to-load-path (dirname (current-filename)))
(use-modules (robot))

(test-begin "robot-name")

(define *robbie* (build-robot))
(define *clutz*  (build-robot))

(test-assert "name matches expected pattern"
             (let ((name (robot-name *robbie*)))
               (and (eq? (string-length name) 5)
                    (string-every char-upper-case? (substring name 0 2))
                    (string-every char-numeric? (substring name 2 5)))))

(test-equal "name is persistent"
            (robot-name *robbie*)
            (robot-name *robbie*))

(test-assert "different robots have different names"
             (not
              (string=?
               (robot-name *robbie*)
               (robot-name *clutz*))))

(test-assert "name can be reset"
             (let* ((robot (build-robot))
                    (original-name (robot-name robot)))
               (reset-name robot)
               (not
                (string=?
                 (robot-name robot)
                 original-name))))

(test-end "robot-name")

Version data entries

396 entries across 396 versions & 1 rubygems

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