Sha256: fb0fe16c8d44793156e02e87af0cfb43b49c946ebda02d5e7fc949102ce7a2c0
Contents?: true
Size: 1.37 KB
Versions: 178
Compression:
Stored size: 1.37 KB
Contents
import unittest from secret_handshake import handshake, code class HandshakeTest(unittest.TestCase): def test_shake_int(self): self.assertEqual(handshake(9), ['wink', 'jump']) def test_shake_bin1(self): self.assertEqual( handshake('10110'), ['close your eyes', 'double blink']) def test_shake_bin2(self): self.assertEqual(handshake('101'), ['wink', 'close your eyes']) def test_shake_negative_int(self): self.assertEqual(handshake(-9), []) def test_shake_bin_invalid(self): self.assertEqual(handshake('121'), []) def test_unknown_action(self): self.assertEqual(code(['wink', 'sneeze']), '0') def test_code1(self): self.assertEqual(code(['close your eyes', 'jump']), '1100') def test_code2(self): self.assertEqual(code(['wink', 'double blink']), '11') def test_code3(self): self.assertEqual(code(['jump', 'double blink']), '11010') def test_composition1(self): self.assertEqual(code(handshake(27)), '11011') def test_composition2(self): self.assertEqual(code(handshake(1)), '1') def test_composition3(self): self.assertEqual(code(handshake('111')), '111') def test_composition4(self): inp = ['wink', 'double blink', 'jump'] self.assertEqual(handshake(code(inp)), inp) if __name__ == '__main__': unittest.main()
Version data entries
178 entries across 178 versions & 1 rubygems