pdf-util-test.el (1646B)
1 ;; -*- lexical-binding: t; -*- 2 3 ;; * ================================================================== * 4 ;; * Tests for pdf-util.el 5 ;; * ================================================================== * 6 7 (require 'ert) 8 9 (ert-deftest pdf-util-seq-alignment () 10 (let ((s1 '(?a ?b ?c)) 11 (s2 '(?a ?b ?c ?d)) 12 (s3 '(-1 ?a ?b ?c)) 13 (s4 '(?e ?f ?g)) 14 (s5 '(?A ?B ?C)) 15 (s6 '(?b))) 16 (should (equal '(2 . ((?a . ?a) (?b . ?b) (?c . ?c) (nil . ?d))) 17 (pdf-util-seq-alignment s1 s2))) 18 19 (should (equal '(3 . ((?a . ?a) (?b . ?b) (?c . ?c) (nil . ?d))) 20 (pdf-util-seq-alignment s1 s2 nil 'prefix))) 21 22 (should (equal '(3 . ((nil . -1) (?a . ?a) (?b . ?b) (?c . ?c))) 23 (pdf-util-seq-alignment s1 s3 nil 'suffix))) 24 25 (should (equal '(3 . ((nil . -1) (?a . ?a) (?b . ?b) (?c . ?c))) 26 (pdf-util-seq-alignment s1 s3 nil 'infix))) 27 28 (should (equal '(1 . ((nil . ?a) (?b . ?b) (nil . ?c))) 29 (pdf-util-seq-alignment s6 s1 nil 'infix))) 30 31 (should (equal '(-3 . ((?a . ?e) (?b . ?f) (?c . ?g))) 32 (pdf-util-seq-alignment s1 s4 nil))) 33 34 (should (equal '(3 . ((?a . ?e) (?b . ?f) (?c . ?g))) 35 (pdf-util-seq-alignment 36 s1 s4 (lambda (a b) 1)))) 37 (should (equal '(3 . ((?A . ?a) (?B . ?b) (?C . ?c))) 38 (pdf-util-seq-alignment 39 s5 s1 (lambda (a b) 40 (if (equal (downcase a) 41 (downcase b)) 42 1 43 -1)))))))