Commits

Alex Mayfield  committed c39bb91

Add some basic unit tests.

  • Participants
  • Parent commits bf40451

Comments (0)

Files changed (3)

+syntax: glob
+*.orig
+*.pyc
+*.swp
+*~
+settings/settings_secret.py

File pyskull/tests/__init__.py

Empty file added.

File pyskull/tests/huffman_test.py

+from pyskull import huffman
+
+def basic_encode_test():
+    h = huffman.HuffmanObject(huffman.SKULLTAG_FREQS)
+    encoded = h.encode("Hello World")
+    assert encoded == '\x04\xeb\x91F\x8c\x18\xe5\x91G5\x8e\xd8\x08'
+
+def basic_decode_test():
+    h = huffman.HuffmanObject(huffman.SKULLTAG_FREQS)
+    decoded = h.decode('\x04\xeb\x91F\x8c\x18\xe5\x91G5\x8e\xd8\x08')
+    assert decoded == "Hello World"
+
+def unencoded_decode_test():
+    h = huffman.HuffmanObject(huffman.SKULLTAG_FREQS)
+    decoded = h.decode('\xffHello World')
+    assert decoded == "Hello World"