
* lisp/emacs-lisp/range.el: New file. * lisp/gnus/gnus-agent.el (range): (gnus-agent-synchronize-group-flags): (gnus-agent-possibly-alter-active): (gnus-agent-fetch-headers): (gnus-agent-read-agentview): (gnus-agent-fetch-group-1): (gnus-agent-read-p): (gnus-agent-expire-group-1): (gnus-agent-retrieve-headers): Adjust callers. * lisp/gnus/gnus-art.el (range): (gnus-article-describe-bindings): * lisp/gnus/gnus-cloud.el (range): (gnus-cloud-available-chunks): * lisp/gnus/gnus-draft.el (gnus-group-send-queue): * lisp/gnus/gnus-group.el (range): (gnus-group-line-format-alist): (gnus-number-of-unseen-articles-in-group): (gnus-group-update-eval-form): (gnus-group-read-group): (gnus-group-delete-articles): (gnus-group-catchup): (gnus-group-expire-articles-1): (gnus-add-marked-articles): * lisp/gnus/gnus-int.el (gnus-request-marks): * lisp/gnus/gnus-kill.el (gnus-apply-kill-file-internal): * lisp/gnus/gnus-range.el (gnus-range-difference) (gnus-sorted-range-intersection, gnus-uncompress-range) (gnus-add-to-range, gnus-remove-from-range) (gnus-member-of-range, gnus-list-range-intersection) (gnus-list-range-difference, gnus-range-length, gnus-range-add) (gnus-range-map): Make into obsolete aliases. * lisp/gnus/gnus-start.el (gnus-make-articles-unread): (gnus-convert-old-ticks): (gnus-read-old-newsrc-el-file): * lisp/gnus/gnus-sum.el (gnus-select-newsgroup): (gnus-articles-to-read): (gnus-articles-to-read): (gnus-killed-articles): (gnus-adjust-marked-articles): (gnus-update-marks): (gnus-update-marks): (gnus-compute-read-articles): (gnus-list-of-read-articles): (gnus-summary-update-info): (gnus-summary-move-article): (gnus-summary-expire-articles): (gnus-update-read-articles): (gnus-summary-insert-old-articles): (gnus-summary-insert-old-articles): (gnus-summary-insert-old-articles): * lisp/gnus/mail-source.el (gnus-range): (gnus-compress-sequence): * lisp/gnus/nnheader.el (range): (gnus-range-add): (nnheader-update-marks-actions): * lisp/gnus/nnimap.el (nnimap-update-info): (nnimap-update-info): (nnimap-update-info): (nnimap-update-qresync-info): (nnimap-update-qresync-info): (nnimap-update-qresync-info): (nnimap-parse-copied-articles): * lisp/gnus/nnmaildir.el (nnmaildir-request-update-info): (nnmaildir-request-update-info): (nnmaildir-request-expire-articles): (nnmaildir-request-expire-articles): (nnmaildir-request-set-mark): * lisp/gnus/nnmairix.el (nnmairix-request-set-mark): * lisp/gnus/nnmbox.el (nnmbox-record-active-article): (nnmbox-record-deleted-article): * lisp/gnus/nnml.el (nnml-request-compact-group): * lisp/gnus/nnvirtual.el (nnvirtual-request-expire-articles): * lisp/gnus/nnselect.el (numbers-by-group): (nnselect-request-update-info): (nnselect-push-info):
65 lines
2.4 KiB
EmacsLisp
65 lines
2.4 KiB
EmacsLisp
;;; range-tests.el --- Tests for range.el -*- lexical-binding: t; -*-
|
|
|
|
;; Copyright (C) 2021 Free Software Foundation, Inc.
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;;
|
|
|
|
;;; Code:
|
|
|
|
(require 'range)
|
|
(require 'ert)
|
|
(require 'ert-x)
|
|
|
|
(ert-deftest ranges ()
|
|
(should (equal (range-compress-list '(2 3 4 5 9 11 12 13))
|
|
'((2 . 5) 9 (11 . 13))))
|
|
(should (equal (range-uncompress '((2 . 5) 9 (11 . 13)))
|
|
'(2 3 4 5 9 11 12 13)))
|
|
(should (equal (range-normalize '(1 . 2))
|
|
'((1 . 2))))
|
|
(should (equal (range-difference '((1 . 10))
|
|
'((2 . 7)))
|
|
'(1 (8 . 10))))
|
|
(should (equal (range-intersection '((2 . 5) 9 (11 . 13))
|
|
'((5 . 12)))
|
|
'(5 9 (11 . 12))))
|
|
(should (equal (range-add-list '((2 . 5) 9 (11 . 13))
|
|
'(10 11 12 15 16 17))
|
|
'((2 . 5) (9 . 10) (11 . 13) (15 . 17))))
|
|
(should (equal (range-remove (copy-tree '((2 . 5) 9 (11 . 13)))
|
|
'((5 . 9)))
|
|
'((2 . 4) (11 . 13))))
|
|
(should (range-member-p 9 '((2 . 5) 9 (11 . 13))))
|
|
(should (range-member-p 12 '((2 . 5) 9 (11 . 13))))
|
|
(should (equal (range-list-intersection
|
|
'(4 5 6 7 8 9)
|
|
'((2 . 5) 9 (11 . 13)))
|
|
'(4 5 9)))
|
|
(should (equal (range-list-difference
|
|
'(4 5 6 7 8 9)
|
|
'((2 . 5) 9 (11 . 13)))
|
|
'(6 7 8)))
|
|
(should (equal (range-length '((2 . 5) 9 (11 . 13)))
|
|
8))
|
|
(should (equal (range-concat '((2 . 5) 9 (11 . 13))
|
|
'(6 (12 . 15)))
|
|
'((2 . 6) 9 (11 . 15)))))
|
|
|
|
;;; range-tests.el ends here
|