まず、gcd.elを用意します。 (defun gcd(a b) "Greatest Common Divisor of A and B" ;; Make a < b (if (> a b) (let ((c a)) (setq a b) (setq b c))) (cond ((< a 0) nil) ((or (= 0 (- b a)) (= a 1)) a) (t (gcd (- b a) a)))) そして、それに対応するテストtest-gcd.elを書きます。 (require 'test-simple) (test-simple-start) ;; テスト開始!カウンターとタイマーをリセット ;; .elを確実に読み込ませるためにrequireの代わりにload-fileを使う (assert-t (load-file "./gcd.el") "gcd.elがないよ!" ) (
![test-simple.el : 最強にシンプルなelisp用テスティングフレームワーク(ユニットテスト)](https://cdn-ak-scissors.b.st-hatena.com/image/square/a3c046ab7bfe74ed8ae2defb7fd7fd66affc6210/height=288;version=1;width=512/http%3A%2F%2Femacs.rubikitch.com%2Fwp-content%2Fuploads%2F2016%2F09%2Femacs.jpg)