2 ;; Copyright (C) 2015 Free Software Foundation, Inc
4 ;; Author: Rocky Bernstein <rocky@gnu.org>
5 ;; URL: http://github.com/rocky/emacs-test-simple
9 ;; This program is free software: you can redistribute it and/or
10 ;; modify it under the terms of the GNU General Public License as
11 ;; published by the Free Software Foundation, either version 3 of the
12 ;; License, or (at your option) any later version.
14 ;; This program is distributed in the hope that it will be useful, but
15 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 ;; General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with this program. If not, see
21 ;; <http://www.gnu.org/licenses/>.
22 ;;;; (test-simple-run "emacs -batch -L %s -l %s" (file-name-directory (locate-library "test-simple.elc")) buffer-file-name)
23 (require 'test-simple)
27 (assert-t (load-file "./gcd.el")
28 "Can't load gcd.el - are you in the right directory?" )
30 (note "degenereate cases")
32 (assert-nil (gcd 5 -1) "using positive numbers")
33 (assert-nil (gcd -4 1) "using positive numbers, switched order")
35 (note "GCD computations")
36 (assert-equal 1 (gcd 3 5) "gcd(3,5)")
37 (assert-equal 8 (gcd 8 32) "gcd(8,32)")
39 (assert-raises error (gcd "a" 32)
40 "Passing a string value should raise an error")