diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2021-11-28 13:03:48 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2021-11-28 13:03:48 -0500 |
commit | 17049953c08b7c783bf73fcb18ddbb7b05c8a671 (patch) | |
tree | 134b4db7e924b4cd803584bef1aef1c0de57d163 /exercism/emacs-lisp/binary/binary-test.el | |
parent | 65951ec5972aec2abbfc8d0dfa2a7227a0fa7223 (diff) |
add exercises
Diffstat (limited to 'exercism/emacs-lisp/binary/binary-test.el')
-rw-r--r-- | exercism/emacs-lisp/binary/binary-test.el | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/exercism/emacs-lisp/binary/binary-test.el b/exercism/emacs-lisp/binary/binary-test.el new file mode 100644 index 0000000..ad8476d --- /dev/null +++ b/exercism/emacs-lisp/binary/binary-test.el @@ -0,0 +1,34 @@ +;;; binary-test.el --- Tests for Binary exercise (exercism) + +;;; Commentary: + +;;; Code: + +(load-file "binary.el") + +(ert-deftest binary-1-is-decimal-1 () + (should (= 1 (to-decimal "1")))) + +(ert-deftest binary-10-is-decimal-2 () + (should (= 2 (to-decimal "10")))) + +(ert-deftest binary-11-is-decimal-3 () + (should (= 3 (to-decimal "11")))) + +(ert-deftest binary-100-is-decimal-4 () + (should (= 4 (to-decimal "100")))) + +(ert-deftest binary-1001-is-decimal-9 () + (should (= 9 (to-decimal "1001")))) + +(ert-deftest binary-11010-is-decimal-26 () + (should (= 26 (to-decimal "11010")))) + +(ert-deftest binary-10001101000-is-decimal-1128 () + (should (= 1128 (to-decimal "10001101000")))) + +(ert-deftest invalid-binary-is-decimal-0 () + (should (= 0 (to-decimal "carrot")))) + +(provide 'binary-test) +;;; binary-test.el ends here |