[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs 7e04991d4e 030/472: Add UT for pacman-compare-asep
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs 7e04991d4e 030/472: Add UT for pacman-compare-aseprite-frames function (#22) |
Date: |
Thu, 6 Jan 2022 21:59:02 -0500 (EST) |
branch: elpa/pacmacs
commit 7e04991d4eca37193482dbecc5c1b6483f4b2bcc
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Add UT for pacman-compare-aseprite-frames function (#22)
---
pacman-anim.el | 13 ++++++-------
test/pacman-anim-test.el | 21 +++++++++++++++++++++
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/pacman-anim.el b/pacman-anim.el
index c3574c0639..cee67bf889 100644
--- a/pacman-anim.el
+++ b/pacman-anim.el
@@ -9,19 +9,18 @@
(aseprite-frames (cdr (assoc 'frames aseprite-json))))
(pacman-make-anim
(mapcar 'pacman-convert-aseprite-frame
- (pacman-aseprite-sort-frame-hack aseprite-frames)))))
+ (sort aseprite-frames
+ 'pacman-compare-aseprite-frames)))))
(defun pacman-aseprite-frame-get-order (aseprite-frame)
(let ((frame-name (symbol-name (car aseprite-frame))))
(string-match "\\([0-9]+\\)\\.ase$" frame-name)
(string-to-number (match-string 1 frame-name))))
-(defun pacman-aseprite-sort-frame-hack (aseprite-frames)
- (sort aseprite-frames
- #'(lambda (f1 f2)
- (let ((o1 (pacman-aseprite-frame-get-order f1))
- (o2 (pacman-aseprite-frame-get-order f2)))
- (< o1 o2)))))
+(defun pacman-compare-aseprite-frames (aseprite-frame1 aseprite-frame2)
+ (let ((order1 (pacman-aseprite-frame-get-order aseprite-frame1))
+ (order2 (pacman-aseprite-frame-get-order aseprite-frame2)))
+ (< order1 order2)))
(defun pacman-convert-aseprite-frame (aseprite-frame)
(let* ((frame (cdr (assoc 'frame (cdr aseprite-frame))))
diff --git a/test/pacman-anim-test.el b/test/pacman-anim-test.el
index d51fb58490..74e32eade1 100644
--- a/test/pacman-anim-test.el
+++ b/test/pacman-anim-test.el
@@ -1,3 +1,6 @@
+(require 'cl) ;el-mock doesn't work without
+ ;this
+
(ert-deftest pacman-anim-get-frame-test ()
(let ((anim (list :frames (number-sequence 1 5)
:current-frame 2)))
@@ -41,3 +44,21 @@
(h . 3)
(w . 4)))))
(should (equal 42 (pacman-aseprite-frame-get-order aseprite-frame)))))
+
+(ert-deftest pacman-compare-aseprite-frames-test ()
+ (let ((aseprite-frame1 '(khooy42.ase
+ (foo . bar)
+ (frame
+ (x . 1)
+ (y . 2)
+ (h . 3)
+ (w . 4))))
+ (aseprite-frame2 '(khooy43.ase
+ (foo . bar)
+ (frame
+ (x . 1)
+ (y . 2)
+ (h . 3)
+ (w . 4)))))
+ (should (pacman-compare-aseprite-frames aseprite-frame1 aseprite-frame2))
+ (should (not (pacman-compare-aseprite-frames aseprite-frame2
aseprite-frame1)))))
- [nongnu] elpa/pacmacs 91c317819c 123/472: Implement basic death mechanics (#69), (continued)
- [nongnu] elpa/pacmacs 91c317819c 123/472: Implement basic death mechanics (#69), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs be91d566cb 139/472: Implement Game Over state. Close #94, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b8cd22229d 142/472: Introduce pacmacs--anim-object-list-next-frame, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 91e432111b 145/472: Implement basic score table mechnism (#92), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7058b61e47 146/472: Implement adding entries to score table (#92), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e032089ab4 151/472: Render score table on Game Over screen (#92), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs a7b0530f65 152/472: Merge branch 'score-table-92'. Close #92, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 1b2ca64cd1 157/472: Merge branch 'resource-packaging-95'. Close #95, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 48ecc5cee9 159/472: Don't fail if the score file doesn't exist, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 10b8a997dd 037/472: More precise instructions in README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7e04991d4e 030/472: Add UT for pacman-compare-aseprite-frames function (#22),
ELPA Syncer <=
- [nongnu] elpa/pacmacs 327332d32d 036/472: Update README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 68f876d0ba 043/472: Merge pull request #29 from rexim/license-28, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 298b950310 062/472: Rename pacman-resources to pacman-image (#51), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs e9703e9ba2 061/472: Rename function for loading images (#51), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 0a65793037 071/472: Use plist-bind for pacman-anim-object-next-frame (#54), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7f706e2159 074/472: Add UTs for plist-map (#54), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 69d47fbb9a 075/472: Merge branch 'pacman-utils-ut-54'. Close #54, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7d16738069 077/472: Implement custom map format. Close #61, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 6d1831c746 081/472: Implement ghost mechanics. Close #62, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 427b4f823e 088/472: Add edebug specs for plist-bind macro (#68), ELPA Syncer, 2022/01/06