aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Corallo2019-11-22 14:42:37 +0100
committerAndrea Corallo2020-01-01 11:38:08 +0100
commitd0e6a276643b2590eebf81e305b006c768653b10 (patch)
tree45e4d09bdd05c9509cda426c38d808da1c885fc8
parent0bf55d3a8131da02999fe694caf34096d7408952 (diff)
downloademacs-d0e6a276643b2590eebf81e305b006c768653b10.tar.gz
emacs-d0e6a276643b2590eebf81e305b006c768653b10.zip
better ert usage into tests
-rw-r--r--test/src/comp-tests.el44
1 files changed, 14 insertions, 30 deletions
diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el
index 55570d48a30..a0e6e23cefd 100644
--- a/test/src/comp-tests.el
+++ b/test/src/comp-tests.el
@@ -79,16 +79,12 @@ Check that the resulting binaries do not differ."
79 (should (equal (comp-tests-list2-f 1 2 3) '(1 2 3))) 79 (should (equal (comp-tests-list2-f 1 2 3) '(1 2 3)))
80 (should (= (comp-tests-car-f '(1 . 2)) 1)) 80 (should (= (comp-tests-car-f '(1 . 2)) 1))
81 (should (null (comp-tests-car-f nil))) 81 (should (null (comp-tests-car-f nil)))
82 (should (= (condition-case err 82 (should-error (comp-tests-car-f 3)
83 (comp-tests-car-f 3) 83 :type 'wrong-type-argument)
84 (error 10))
85 10))
86 (should (= (comp-tests-cdr-f '(1 . 2)) 2)) 84 (should (= (comp-tests-cdr-f '(1 . 2)) 2))
87 (should (null (comp-tests-cdr-f nil))) 85 (should (null (comp-tests-cdr-f nil)))
88 (should (= (condition-case err 86 (should-error (comp-tests-cdr-f 3)
89 (comp-tests-cdr-f 3) 87 :type 'wrong-type-argument)
90 (error 10))
91 10))
92 (should (= (comp-tests-car-safe-f '(1 . 2)) 1)) 88 (should (= (comp-tests-car-safe-f '(1 . 2)) 1))
93 (should (null (comp-tests-car-safe-f 'a))) 89 (should (null (comp-tests-car-safe-f 'a)))
94 (should (= (comp-tests-cdr-safe-f '(1 . 2)) 2)) 90 (should (= (comp-tests-cdr-safe-f '(1 . 2)) 2))
@@ -191,24 +187,18 @@ Check that the resulting binaries do not differ."
191 (should (= (comp-tests-fixnum-1-minus-f 10) 9)) 187 (should (= (comp-tests-fixnum-1-minus-f 10) 9))
192 (should (= (comp-tests-fixnum-1-minus-f most-negative-fixnum) 188 (should (= (comp-tests-fixnum-1-minus-f most-negative-fixnum)
193 (1- most-negative-fixnum))) 189 (1- most-negative-fixnum)))
194 (should (equal (condition-case err 190 (should-error (comp-tests-fixnum-1-minus-f 'a)
195 (comp-tests-fixnum-1-minus-f 'a) 191 :type 'wrong-type-argument)
196 (error err))
197 '(wrong-type-argument number-or-marker-p a)))
198 (should (= (comp-tests-fixnum-1-plus-f 10) 11)) 192 (should (= (comp-tests-fixnum-1-plus-f 10) 11))
199 (should (= (comp-tests-fixnum-1-plus-f most-positive-fixnum) 193 (should (= (comp-tests-fixnum-1-plus-f most-positive-fixnum)
200 (1+ most-positive-fixnum))) 194 (1+ most-positive-fixnum)))
201 (should (equal (condition-case err 195 (should-error (comp-tests-fixnum-1-plus-f 'a)
202 (comp-tests-fixnum-1-plus-f 'a) 196 :type 'wrong-type-argument)
203 (error err))
204 '(wrong-type-argument number-or-marker-p a)))
205 (should (= (comp-tests-fixnum-minus-f 10) -10)) 197 (should (= (comp-tests-fixnum-minus-f 10) -10))
206 (should (= (comp-tests-fixnum-minus-f most-negative-fixnum) 198 (should (= (comp-tests-fixnum-minus-f most-negative-fixnum)
207 (- most-negative-fixnum))) 199 (- most-negative-fixnum)))
208 (should (equal (condition-case err 200 (should-error (comp-tests-fixnum-minus-f 'a)
209 (comp-tests-fixnum-minus-f 'a) 201 :type 'wrong-type-argument))
210 (error err))
211 '(wrong-type-argument number-or-marker-p a))))
212 202
213(ert-deftest comp-tests-arith-comp () 203(ert-deftest comp-tests-arith-comp ()
214 "Testing arithmetic comparisons." 204 "Testing arithmetic comparisons."
@@ -232,16 +222,10 @@ Check that the resulting binaries do not differ."
232 "Testing setcar setcdr." 222 "Testing setcar setcdr."
233 (should (equal (comp-tests-setcar-f '(10 . 10) 3) '(3 . 10))) 223 (should (equal (comp-tests-setcar-f '(10 . 10) 3) '(3 . 10)))
234 (should (equal (comp-tests-setcdr-f '(10 . 10) 3) '(10 . 3))) 224 (should (equal (comp-tests-setcdr-f '(10 . 10) 3) '(10 . 3)))
235 (should (equal (condition-case 225 (should-error (comp-tests-setcar-f 3 10)
236 err 226 :type 'wrong-type-argument)
237 (comp-tests-setcar-f 3 10) 227 (should-error (comp-tests-setcdr-f 3 10)
238 (error err)) 228 :type 'wrong-type-argument))
239 '(wrong-type-argument consp 3)))
240 (should (equal (condition-case
241 err
242 (comp-tests-setcdr-f 3 10)
243 (error err))
244 '(wrong-type-argument consp 3))))
245 229
246(ert-deftest comp-tests-bubble-sort () 230(ert-deftest comp-tests-bubble-sort ()
247 "Run bubble sort." 231 "Run bubble sort."