Mercurial > ppgen
comparison ppgen.py @ 2:a099246680ae
Fix for the unique test.
This was working in simple tests before.
Thanks for Sascha L. Teichmann for detailed reporting.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Mon, 02 May 2016 09:23:18 +0200 |
parents | 00ed7df30fe4 |
children | 757625ec8364 |
comparison
equal
deleted
inserted
replaced
1:00ed7df30fe4 | 2:a099246680ae |
---|---|
38 global tainted | 38 global tainted |
39 d = [] | 39 d = [] |
40 | 40 |
41 # dictionary for testing | 41 # dictionary for testing |
42 #d = ["abc", "aBc", "cde", "efg", "hij", "blubber", "jikf", "zug", "lmf", "opq"] | 42 #d = ["abc", "aBc", "cde", "efg", "hij", "blubber", "jikf", "zug", "lmf", "opq"] |
43 # second test dictionary to show that different string functions are used. | |
44 #d = [''.join('A' * 1000) for _ in range(1000)] | |
43 | 45 |
44 # Using the dictionary from Ding **customize** | 46 # Using the dictionary from Ding **customize** |
45 d = readDingDict(filename="/usr/share/trans/de-en", useLeft=True) | 47 d = readDingDict(filename="/usr/share/trans/de-en", useLeft=True) |
46 | 48 |
47 ## for debugging purpuses, dump dictionary | 49 ## for debugging purpuses, dump dictionary |
120 howMany)) | 122 howMany)) |
121 print(" ", end='') | 123 print(" ", end='') |
122 words = {} | 124 words = {} |
123 for x in range(howMany): | 125 for x in range(howMany): |
124 word = _srandom.choice(dictionary) | 126 word = _srandom.choice(dictionary) |
125 words[word.lower]= True | 127 words[word.lower()]= True |
126 print(word, end='\n ') | 128 print(word, end='\n ') |
127 print("\n") | 129 print("\n") |
128 | 130 |
129 if len(words) < howMany: | 131 if len(words) < howMany: |
130 print("! Your random generator is weak") | 132 print("! Your random generator is weak") |