summaryrefslogtreecommitdiff
path: root/password-philosophy/pp-test.scm
diff options
context:
space:
mode:
Diffstat (limited to 'password-philosophy/pp-test.scm')
-rw-r--r--password-philosophy/pp-test.scm33
1 files changed, 24 insertions, 9 deletions
diff --git a/password-philosophy/pp-test.scm b/password-philosophy/pp-test.scm
index 7641c4a..f1b9c64 100644
--- a/password-philosophy/pp-test.scm
+++ b/password-philosophy/pp-test.scm
@@ -22,19 +22,19 @@
(count-occurrences "zzf9ct5f" #\f))
(test-assert "Single X"
- (valid-password? "X" #\X '(1 . 1)))
+ (valid-password-p1? "X" #\X '(1 . 1)))
(test-assert "Single X extra"
- (valid-password? "the X marks the spot" #\X '(1 . 1)))
+ (valid-password-p1? "the X marks the spot" #\X '(1 . 1)))
(test-assert "Double X allowed"
- (valid-password? "X lots of bad things use the logo of just an X" #\X '(1 . 2)))
+ (valid-password-p1? "X lots of bad things use the logo of just an X" #\X '(1 . 2)))
(test-assert "Double X forced"
- (valid-password? "X lots of bad things use the logo of just an X" #\X '(2 . 2)))
+ (valid-password-p1? "X lots of bad things use the logo of just an X" #\X '(2 . 2)))
(test-assert "Double X failed"
- (not (valid-password? "lots of bad things use the logo of just an X" #\X '(2 . 2))))
+ (not (valid-password-p1? "lots of bad things use the logo of just an X" #\X '(2 . 2))))
(test-equal "Parse line 1"
'("abcde" #\a (1 . 3))
@@ -48,25 +48,40 @@
0
(pp "1-3 a: bcde
1-3 b: cdefg
-2-9 c: cccccccccc"))
+2-9 c: cccccccccc" #t))
(test-equal "Count valid 1"
1
(pp "1-3 a: abcde
1-3 b: cdefg
-2-9 c: cccccccccc"))
+2-9 c: cccccccccc" #t))
(test-equal "Count valid 2"
2
(pp "1-3 a: abcde
1-3 b: cdefg
-2-9 c: ccccccccc"))
+2-9 c: ccccccccc" #t))
(test-equal "Count valid 3"
3
(pp "1-3 a: abcde
1-3 b: cdbfg
-2-9 c: ccccccccc"))
+2-9 c: ccccccccc" #t))
+
+(test-assert "First char matched"
+ (valid-password-p2? ":)" #\) '(1 . 2)))
+
+(test-assert "Neither chars matched"
+ (not (valid-password-p2? ":(" #\) '(1 . 2))))
+
+(test-assert "Example 1"
+ (valid-password-p2? "abcde" #\a '(1 . 3)))
+
+(test-assert "Example 2"
+ (not (valid-password-p2? "cdefg" #\b '(1 . 3))))
+
+(test-assert "Example 3"
+ (not (valid-password-p2? "cccccccccc" #\a '(2 . 9))))
(test-end "harness")