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