add ananas
This commit is contained in:
parent
dd73232769
commit
0d0a05e7f5
2 changed files with 48 additions and 2 deletions
|
@ -66,6 +66,14 @@ def dec2avocado(word):
|
|||
return encoder(word, 1, 1)
|
||||
|
||||
|
||||
def ananas2dec(word):
|
||||
return decoder(word, 1, 0)
|
||||
|
||||
|
||||
def dec2ananas(word):
|
||||
return encoder(word, 1, 0)
|
||||
|
||||
|
||||
def bananarandom(dictstart=0, shiftend=0, minlength=6, dictionary=None):
|
||||
import random
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"""Tests for `banana` package."""
|
||||
import pytest
|
||||
|
||||
from banana import (avocado2dec, banana2dec, dec2avocado, dec2banana,
|
||||
dec2ribes, ribes2dec)
|
||||
from banana import (ananas2dec, avocado2dec, banana2dec, dec2ananas,
|
||||
dec2avocado, dec2banana, dec2ribes, ribes2dec)
|
||||
|
||||
banana_conversions = {"be": 1, "beba": 70, "zu": 69, "bezu": 139, "nana": 2485}
|
||||
|
||||
|
@ -50,6 +50,34 @@ def ribes_known(request):
|
|||
yield request.param
|
||||
|
||||
|
||||
ananas_conversions = {
|
||||
"ac": 1,
|
||||
"al": 5,
|
||||
"as": 10,
|
||||
"ec": 15,
|
||||
"em": 20,
|
||||
"et": 25,
|
||||
"id": 30,
|
||||
"in": 35,
|
||||
"iv": 40,
|
||||
"of": 45,
|
||||
"op": 50,
|
||||
"oz": 55,
|
||||
"ug": 60,
|
||||
"ur": 65,
|
||||
"acab": 70,
|
||||
"acal": 75,
|
||||
"acas": 80,
|
||||
"acec": 85,
|
||||
"acem": 90,
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture(params=ananas_conversions.items())
|
||||
def ananas_known(request):
|
||||
yield request.param
|
||||
|
||||
|
||||
def test_banana_to_dec_known(banana_known):
|
||||
word, value = banana_known
|
||||
assert banana2dec(word) == value
|
||||
|
@ -87,6 +115,16 @@ def test_dec_to_avocado_known(avocado_known):
|
|||
assert dec2avocado(value) == word
|
||||
|
||||
|
||||
def test_ananas_to_dec_known(ananas_known):
|
||||
word, value = ananas_known
|
||||
assert ananas2dec(word) == value
|
||||
|
||||
|
||||
def test_dec_to_ananas_known(ananas_known):
|
||||
word, value = ananas_known
|
||||
assert dec2ananas(value) == word
|
||||
|
||||
|
||||
def test_answer_to_life_the_universe_and_everything():
|
||||
banana = banana2dec("banana")
|
||||
assert banana != 42
|
||||
|
|
Loading…
Reference in a new issue