-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from corbett/master
test data generation code and file, README updated for #3
- Loading branch information
Showing
5 changed files
with
588 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python | ||
|
||
from hexadecimal_testdata.hexdata import genData as hexData | ||
from englishword_testdata.gen_basic import genData as englishWordData | ||
from englishpoems_testdata.gendata import genData as englishPoemData | ||
from pseudoword_testdata.keyname_script import genData as pseudoWordData | ||
|
||
print "#1. Hexadecimal digits ala PGP fingerprints" | ||
for f in hexData(): | ||
print f | ||
print "#2. English Words" | ||
for f in englishWordData(): | ||
print f | ||
print "#3. English poems" | ||
for f in englishPoemData(): | ||
print f | ||
print "#4. Pseudowords" | ||
for f in pseudoWordData(): | ||
print f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,56 @@ | ||
#!/usr/bin/env python | ||
|
||
from random import choice | ||
import sys | ||
|
||
from hexadecimal_testdata.hexdata import genData as hexData | ||
from englishword_testdata.gen_basic import genData as englishWordData | ||
from englishpoems_testdata.gendata import genData as englishPoemData | ||
from pseudoword_testdata.keyname_script import genData as pseudoWordData | ||
|
||
for f in hexData(): | ||
print f | ||
for f in englishWordData(): | ||
print f | ||
for f in englishPoemData(): | ||
print f | ||
for f in pseudoWordData(): | ||
print f | ||
""" | ||
4 Fingerprint Types (TODO: what happened to 5th?) | ||
2 Comparison Mechanisms | ||
2 Error Rates | ||
x 2 Outcomes (Match or Not-Match) | ||
--- | ||
32 Test Cases | ||
Run: ./genTestData.py <testerpairs> > testData.csv | ||
""" | ||
|
||
|
||
def farFingerprintsToCompare(genData) : | ||
perfectMatch,almostMatch = genData() | ||
noMatch,noMatch = genData() | ||
return perfectMatch,choice([perfectMatch,noMatch]) | ||
|
||
def closeFingerprintsToCompare(genData): | ||
perfectMatch,almostMatch = genData() | ||
noMatch,noMatch = genData() | ||
return perfectMatch,choice([perfectMatch,almostMatch]) | ||
|
||
def normalize(s): | ||
return s.strip().replace('\n','<br>') | ||
|
||
|
||
fingerprints = {'hex':hexData,'english word':englishWordData,'english poem':englishPoemData,'pseudo word':pseudoWordData} | ||
comparisons = ['Business card','Phone'] | ||
errors = {'large mismatch':farFingerprintsToCompare,'small mismatch':closeFingerprintsToCompare} | ||
outcomes = ['match','not match'] | ||
|
||
def genTestData(testerpairs): | ||
print '#pair\tfingerprint\tcomparison\terror\tAlice\tBob\tjudgement' | ||
for tid in range(testerpairs): | ||
for mech in comparisons: | ||
for errorDesc,errorFunc in errors.items(): | ||
for fingerprintDesc,fingerprintFunc in fingerprints.items(): | ||
for possibleOutcome in outcomes: | ||
alicePrint,bobPrint = errorFunc(fingerprintFunc) | ||
print '\t'.join([str(tid),fingerprintDesc,mech,errorDesc,normalize(alicePrint),normalize(bobPrint)]) | ||
|
||
|
||
if __name__ == '__main__': | ||
genTestData(int(sys.argv[1])) | ||
|
||
|
Empty file.
Oops, something went wrong.