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.119 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.118 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.117 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.116 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.115 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.114 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.113 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.111 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.110 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.109 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.108 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.107 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.106 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.105 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.104 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.103 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.102 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.101 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.100 tracks/elisp/exercises/robot-name/robot-name-test.el
trackler-2.2.1.99 tracks/elisp/exercises/robot-name/robot-name-test.el