X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=tests%2Ftest_languge_models.py;fp=tests%2Ftest_languge_models.py;h=0e00104dc34ea589e540e7e283d7662145442b04;hb=3350a462f460e81d96c587466f5b6a88cbba1f7e;hp=0000000000000000000000000000000000000000;hpb=14e5bc61282ef63116332c48bc9e4265fdc486c5;p=szyfrow.git

diff --git a/tests/test_languge_models.py b/tests/test_languge_models.py
new file mode 100644
index 0000000..0e00104
--- /dev/null
+++ b/tests/test_languge_models.py
@@ -0,0 +1,18 @@
+import pytest
+import string 
+
+from szyfrow.support.language_models import *
+
+def test_transpositions_of():
+    assert transpositions_of('clever') == (0, 2, 1, 4, 3)
+    assert transpositions_of('fred') == (3, 2, 0, 1)
+    assert transpositions_of((3, 2, 0, 1)) == (3, 2, 0, 1)
+
+def test_ngrams():
+    assert ngrams(sanitise('the quick brown fox'), 2) == ['th', 'he', 'eq', 
+        'qu', 'ui', 'ic', 'ck', 'kb', 'br', 'ro', 'ow', 'wn', 
+        'nf', 'fo', 'ox']
+    assert ngrams(sanitise('the quick brown fox'), 4) == ['theq', 'hequ', 
+        'equi', 'quic', 'uick', 'ickb', 'ckbr', 'kbro', 'brow', 
+        'rown', 'ownf', 'wnfo', 'nfox']
+    
\ No newline at end of file