summaryrefslogtreecommitdiff
path: root/gnosis-test.el
diff options
context:
space:
mode:
Diffstat (limited to 'gnosis-test.el')
-rw-r--r--gnosis-test.el92
1 files changed, 92 insertions, 0 deletions
diff --git a/gnosis-test.el b/gnosis-test.el
index 931fdcb..e842e8e 100644
--- a/gnosis-test.el
+++ b/gnosis-test.el
@@ -411,6 +411,98 @@ If ask nil, leave testing env"
:c-failures 3)
'(0.45 0.3 3.2))))
+(ert-deftest gnosis-test-get-note-deck-value ()
+ "Test recovery of deck amnesia values."
+ (let ((test-values '((:deck "demo"
+ (:proto (0 1 3) :anagnosis 3 :epignosis 0.5 :agnoia 0.3 :amnesia 0.5 :lethe 3))
+ (:deck "demo2"
+ (:proto (0 1 3)))
+ (:tag "demo"
+ (:proto (1 2) :anagnosis 2 :epignosis 0.2 :agnoia 0.3 :amnesia 0.4 :lethe 4)))))
+ (should (= (gnosis-get-custom-deck-value "demo" :amnesia test-values) 0.5))
+ (should (= (gnosis-get-note-deck-epignosis nil "demo" test-values) 0.5))
+ (should (= (gnosis-get-note-deck-amnesia nil "demo" test-values) 0.5))
+ (should (= (gnosis-get-note-deck-agnoia nil "demo" test-values) 0.3))
+ (should (= (gnosis-get-note-deck-anagnosis nil "demo" test-values) 3))
+ (should (= (gnosis-get-note-deck-lethe nil "demo" test-values) 3))
+ (should (= (gnosis-get-note-deck-lethe nil "demo" test-values) 3))
+ (should (= (gnosis-get-note-deck-lethe nil "demo2" test-values) gnosis-algorithm-lethe-value))
+ (should (= (gnosis-get-note-deck-anagnosis nil "demo2" test-values) gnosis-algorithm-anagnosis-value))
+ (should (= (gnosis-get-note-deck-epignosis nil "demo2" test-values) gnosis-algorithm-epignosis-value))
+ (should (= (gnosis-get-note-deck-agnoia nil "demo2" test-values) gnosis-algorithm-agnoia-value))
+ (should (= (gnosis-get-note-deck-amnesia nil "demo2" test-values) gnosis-algorithm-amnesia-value))))
+
+(ert-deftest gnosis-test-get-custom-tag-amnesia ()
+ "Test recovery of tag amnesia values."
+ (let ((test-values '((:deck "tag1" (:proto (99 99 99) :epignosis 0.5 :agnoia 0.3 :amnesia 0.5 :lethe 3))
+ (:tag "tag1" (:proto (0 1 3) :epignosis 0.5 :agnoia 0.3 :amnesia 0.3 :lethe 3))
+ (:tag "tag2" (:proto (1 2) :epignosis 0.5 :agnoia 0.3 :amnesia 0.5 :lethe 4))
+ (:tag "tag3" (:proto (2 4 10) :epignosis 0.5 :agnoia 0.5 :amnesia 0.9 :lethe 2)))))
+ (should (equal (gnosis-get-custom-tag-values nil :amnesia '("tag1") test-values) (list 0.3)))
+ (should (equal (gnosis-get-note-tag-amnesia nil '("tag1") test-values) 0.3))
+ (should (equal (gnosis-get-note-tag-amnesia nil '("tag1" "tag2") test-values) 0.3))
+ (should (equal (gnosis-get-note-tag-amnesia nil '("tag1" "tag2" "tag3") test-values) 0.3))
+ (should (equal (gnosis-get-note-tag-amnesia nil '("tag2" "tag3") test-values) 0.5))))
+
+(ert-deftest gnosis-test-get-proto ()
+ (let ((test-values '((:deck "deck1" (:proto (0 1 3) :epignosis 0.5 :agnoia 0.3 :amnesia 0.3 :lethe 3))
+ (:tag "tag1" (:proto (10 1) :epignosis 0.5))
+ (:tag "tag2" (:proto (2 2 2) :epignosis 0.5))
+ (:tag "tag3" (:proto (1 1 1 1) :epignosis 0.5)))))
+ (should (equal (gnosis-get-note-proto nil '("tag1") "deck1" test-values) '(10 1 3)))
+ (should (equal (gnosis-get-note-proto nil '("tag1" "tag2") "deck1" test-values) '(10 2 3)))
+ (should (equal (gnosis-get-note-proto nil '("tag1" "tag2" "tag3") "deck1" test-values) '(10 2 3 1)))
+ (should (equal (gnosis-get-note-proto nil '("tag2" "tag3") "deck1" test-values) '(2 2 3 1)))))
+
+(ert-deftest gnosis-test-get-note-amnesia ()
+ (let ((test-values '((:deck "deck1" (:proto (0 1 3) :epignosis 0.5 :agnoia 0.3 :amnesia 0.3 :lethe 3))
+ (:tag "tag1" (:proto (10 1) :epignosis 0.5 :amnesia 0.5))
+ (:tag "tag2" (:proto (2 2 2) :epignosis 0.5 :amnesia 0.2))
+ (:tag "tag3" (:proto (1 1 1 1) :epignosis 0.5 :amnesia 0.4)))))
+ (should (equal (gnosis-get-note-amnesia nil "deck1" '("tag1") test-values) 0.3))
+ (should (equal (gnosis-get-note-amnesia nil "deck1" '("tag1" "tag2") test-values) 0.2))
+ (should (equal (gnosis-get-note-amnesia nil "deck1" '("tag1" "tag3") test-values) 0.3))))
+
+(ert-deftest gnosis-test-get-note-epginosis ()
+ (let ((test-values'((:deck "deck1" (:proto (0 1 3) :epignosis 0.5 :agnoia 0.3 :amnesia 0.3 :lethe 3))
+ (:tag "tag1" (:proto (10 1) :epignosis 0.4 :amnesia 0.5))
+ (:tag "tag2" (:proto (2 2 2) :epignosis 0.6 :amnesia 0.2))
+ (:tag "tag3" (:proto (1 1 1 1) :epignosis 0.7 :amnesia 0.4)))))
+ (should (equal (gnosis-get-note-epignosis nil "deck1" '("tag1") test-values) 0.5))
+ (should (equal (gnosis-get-note-epignosis nil "deck1" '("tag1" "tag2") test-values) 0.6))
+ (should (equal (gnosis-get-note-epignosis nil "deck1" '("tag2" "tag3") test-values) 0.7))))
+
+(ert-deftest gnosis-test-get-note-agnoia ()
+ (let ((test-values'((:deck "deck1" (:proto (0 1 3) :epignosis 0.5 :agnoia 0.3 :amnesia 0.3 :lethe 3))
+ (:tag "tag1" (:proto (10 1) :epignosis 0.4 :amnesia 0.5))
+ (:tag "tag2" (:proto (2 2 2) :epignosis 0.6 :amnesia 0.2 :agnoia 0.4))
+ (:tag "tag3" (:proto (1 1 1 1) :epignosis 0.7 :amnesia 0.4 :agnoia 0.5)))))
+ (should (equal (gnosis-get-note-agnoia nil "deck1" '("tag1") test-values) 0.3))
+ (should (equal (gnosis-get-note-agnoia nil "deck1" '("tag1" "tag2") test-values) 0.4))
+ (should (equal (gnosis-get-note-agnoia nil "deck1" '("tag1" "tag2" "tag3") test-values) 0.5))))
+
+(ert-deftest gnosis-test-get-note-anagnosis ()
+ (let ((test-values '((:deck "deck1" (:proto (0 1 3) :anagnosis 3 :amnesia 0.3 :lethe 3))
+ (:deck "deck2" (:anagnosis 1 :amnesia 0.3 :lethe 3))
+ (:tag "tag1" (:proto (10 1) :amnesia 0.5 :anagnosis 4))
+ (:tag "tag2" (:proto (2 2 2) :amnesia 0.2 :agnoia 0.4 :anagnosis 2))
+ (:tag "tag3" (:proto (1 1 1 1) :amnesia 0.3)))))
+ (should (equal (gnosis-get-note-anagnosis nil "deck1" '("tag1") test-values) 3))
+ (should (equal (gnosis-get-note-anagnosis nil "deck1" '("tag1" "tag2") test-values) 2))
+ (should (equal (gnosis-get-note-anagnosis nil "deck2" '("tag1" "tag2") test-values) 1))))
+
+(ert-deftest gnosis-test-get-note-lethe ()
+ (let ((test-values '((:deck "deck1" (:proto (0 1 3) :anagnosis 3 :amnesia 0.3 :lethe 3))
+ (:deck "deck2" (:anagnosis 1 :lethe 9))
+ (:tag "tag1" (:proto (10 1) :lethe 4))
+ (:tag "tag2" (:proto (2 2 2) :lethe 2))
+ (:tag "tag3" (:proto (1 1 1 1) :amnesia 0.3)))))
+ (should (equal (gnosis-get-note-lethe nil "deck1" '("tag1") test-values) 3))
+ (should (equal (gnosis-get-note-lethe nil "deck1" '("tag2") test-values) 2))
+ (should (equal (gnosis-get-note-lethe nil "deck2" '("tag1") test-values) 4))
+ (should (equal (gnosis-get-note-lethe nil "deck2" '("tag1" "tag2") test-values) 2))))
+
+
(ert-run-tests-batch-and-exit)
(provide 'gnosis-test)