Commit 9fb19a6c authored by pfdietz's avatar pfdietz
Browse files

Added more remove-duplicates, delete-duplicates tests. Check that when we're...

Added more remove-duplicates, delete-duplicates tests.  Check that when we're comparing under EQUAL or EQUALP, the item preserved (under EQL) is as dictated by the value of FROM-END
parent 61882587
......@@ -329,7 +329,134 @@
(assert (string= s2 "abcdefgz"))))
nil)
;;; Order of elements kept under EQUAL, EQUALP tests
(deftest remove-duplicates.2
(let* ((x (list 'a))
(y (list 'a))
(result (remove-duplicates (list x y) :test 'equal)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a)) nil t)
(deftest remove-duplicates.2a
(let* ((x (list 'a))
(y (list 'a))
(result (remove-duplicates (list x 'x y) :test 'equal)))
(values
result
(notnot (eql (cadr result) x))
(notnot (eql (cadr result) y))))
(x (a)) nil t)
(deftest remove-duplicates.3
(let* ((x (list 'a))
(y (list 'a))
(result (remove-duplicates (list x y) :test 'equal :from-end t)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a)) t nil)
(deftest remove-duplicates.3a
(let* ((x (list 'a))
(y (list 'a))
(result (remove-duplicates (list x 'u 'v y) :test 'equal :from-end t)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a) u v) t nil)
(deftest remove-duplicates.4
(let* ((x (list 'a))
(y (list 'a))
(result (remove-duplicates (list x y) :test 'equalp)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a)) nil t)
(deftest remove-duplicates.5
(let* ((x (list 'a))
(y (list 'a))
(result (remove-duplicates (list x y) :test 'equalp :from-end t)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a)) t nil)
;;; Similar, but destructive
(deftest delete-duplicates.2
(let* ((x (list 'a))
(y (list 'a))
(result (delete-duplicates (list x y) :test 'equal)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a)) nil t)
(deftest delete-duplicates.2a
(let* ((x (list 'a))
(y (list 'a))
(result (delete-duplicates (list x 'x y) :test 'equal)))
(values
result
(notnot (eql (cadr result) x))
(notnot (eql (cadr result) y))))
(x (a)) nil t)
(deftest delete-duplicates.3
(let* ((x (list 'a))
(y (list 'a))
(result (delete-duplicates (list x y) :test 'equal :from-end t)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a)) t nil)
(deftest delete-duplicates.3a
(let* ((x (list 'a))
(y (list 'a))
(result (delete-duplicates (list x 'u 'v y) :test 'equal :from-end t)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a) u v) t nil)
(deftest delete-duplicates.4
(let* ((x (list 'a))
(y (list 'a))
(result (delete-duplicates (list x y) :test 'equalp)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a)) nil t)
(deftest delete-duplicates.5
(let* ((x (list 'a))
(y (list 'a))
(result (delete-duplicates (list x y) :test 'equalp :from-end t)))
(values
result
(notnot (eql (car result) x))
(notnot (eql (car result) y))))
((a)) t nil)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment