Skip to content
This repository has been archived by the owner on Sep 20, 2020. It is now read-only.

Commit

Permalink
Add some test
Browse files Browse the repository at this point in the history
  • Loading branch information
northox committed Mar 19, 2012
1 parent 30d2db0 commit 9e7d996
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,19 @@ The most complex usage could look like this:
}
}

# Todo
# Test

* Post some test.
Let's take the most common passwords

$ php test.php
FAIL: football
FAIL: fOOtb4ll
FAIL: pr1nce55
FAIL: b4byg1r1
FAIL: passw0rd
FAIL: P@ssw0rd
FAIL: zxcasdqwe
FAIL: zxc45dqw3

# License
BSD license. In other word it's free software, free as in free beer.
Expand Down
8 changes: 2 additions & 6 deletions StupidPass.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,8 @@ private function expand(&$map, $old = array(), $index = 0) {
}
}
unset($old);
if($index == count($map)-1) {
return $new;
} else {
$index++;
return $this->expand($map, $new, $index);
}
$r = ($index == count($map)-1) ? $new : $this->expand($map, $new, $index + 1);
return $r;
}
}
?>
20 changes: 20 additions & 0 deletions test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
// Test Stupid Password
require('StupidPass.class.php');
$list = array(
'football',
'fOOtb4ll',
'pr1nce55',
'b4byg1r1',
'passw0rd',
'P@ssw0rd',
'zxcasdqwe',
'zxc45dqw3'
);

$sp = new StupidPass();
foreach ($list as $pass) {
$m = ($sp->validate($pass) == false) ? "FAIL: " : "PASS: ";
print("$m $pass\n");
}
?>

0 comments on commit 9e7d996

Please sign in to comment.