Sha256: 9f0d3ff8bed2af50f24827588c373a7cd47fe07e87970a57aaf3aa943cf14977

Contents?: true

Size: 1010 Bytes

Versions: 213

Compression:

Stored size: 1010 Bytes

Contents

;;; robot-name-test.el --- Tests for Robot Name (exercism)

;;; Commentary:

;; Ported pretty much directly from the xlisp version :)

;;; Code:

(require 'rx)

(load-file "robot-name.el")

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

(defvar robot-name-re
  (rx string-start
      (= 2 upper-case)
      (= 3 digit)
      string-end))

(ert-deftest name-matches-expected-pattern ()
  (let ((name (robot-name *robbie*)))
    (should (string-match-p robot-name-re name))))

(ert-deftest name-is-persistent ()
  "Test that robot name is persistent."
  (should (equal (robot-name *robbie*) (robot-name *robbie*))))

(ert-deftest different-robots-have-different-names ()
  (should-not (equal (robot-name *robbie*) (robot-name *clutz*))))

(ert-deftest name-can-be-reset ()
  (let* ((robot (build-robot))
         (original-name (robot-name robot)))
    (reset-robot robot)
    (should-not (equal original-name (robot-name robot)))))

(provide 'robot-name-test)
;;; robot-name-test.el ends here

Version data entries

213 entries across 213 versions & 1 rubygems

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