Esempio n. 1
0
 def test_v1SkipCompressionString(self):
   decompressor = Decompressor()
   self.assertEqual(decompressor.calculateUncompressedLength('X(8x2)(3x3)ABCY'), 18)
Esempio n. 2
0
 def test_v1ManyDecompressions(self):
   decompressor = Decompressor()
   self.assertEqual(decompressor.calculateUncompressedLength('A(2x2)BCD(2x2)EFG'), 11)
Esempio n. 3
0
 def test_v1OneChar(self):
   decompressor = Decompressor()
   self.assertEqual(decompressor.calculateUncompressedLength('(6x1)(1x3)A'), 6)
Esempio n. 4
0
 def test_v1OneCharacterCompressed(self):
   decompressor = Decompressor()
   self.assertEqual(decompressor.calculateUncompressedLength('A(1x5)BC'), 7)
Esempio n. 5
0
 def test_v1ManyCharactersCompressed(self):
   decompressor = Decompressor()
   self.assertEqual(decompressor.calculateUncompressedLength('(3x3)XYZ'), 9)
Esempio n. 6
0
 def test_example_5(self):
     output = Decompressor().get_decompressed_length('(6x1)(1x3)A')
     self.assertEqual(6, output)
Esempio n. 7
0
    lora = LoRa(mode=LoRa.LORAWAN)
    increase_delivary_chances_function = CoAP.increase_delivary_chances_functions[
        "LORAWAN"]
if SIGFOX:
    sigfox = Sigfox(mode=Sigfox.SIGFOX, rcz=Sigfox.RCZ1)
    increase_delivary_chances_function = CoAP.increase_delivary_chances_functions[
        "SIGFOX"]

RM = RuleManager()
RM.addRule(rule_coap0)
RM.addRule(rule_coap1)
RM.addRule(rule_coap2)

p = Parser()
comp = Compressor(RM)
dec = Decompressor(RM)
coapC = CoAP.CoAPSM(p, comp, dec, IPv6_source, IPv6_dest,
                    increase_delivary_chances_function)

app_eui = binascii.unhexlify('00 00 00 00 00 00 00 00'.replace(' ', ''))
app_key = binascii.unhexlify(
    '11 22 33 44 55 66 77 88 11 22 33 44 55 66 77 88'.replace(' ', ''))

pycom.heartbeat(False)

if LORAWAN:
    mac = lora.mac()
    print('MAC:')
    print(hex(mac[0]), end='-')
    print(hex(mac[1]), end='-')
    print(hex(mac[2]), end='-')
Esempio n. 8
0
 def test_example_2(self):
     output = Decompressor().get_decompressed_length('A(1x5)BC')
     self.assertEqual(7, output)
Esempio n. 9
0
from Model import Model
from Compressor import Compressor
from Read_bit import Read_bit
from Decompressor import Decompressor
import sys,os

mode = sys.argv[1]
filename = sys.argv[2]
model = Model(filename.split(".")[0]+'.txt')
#print model.c
if mode == "-c":
    print "----------compressing-----------"
    c = Compressor(filename,model)
    c.compress()
elif mode == "-d":
    print "---------decompressing----------"
    d = Decompressor(filename,model)
    d.decompress()





Esempio n. 10
0
 def test_example_2d(self):
     output = Decompressor().get_decompressed_length_v2(
         '(25x3)(3x3)ABC(2x3)XY(5x2)PQRSTX(18x9)(3x2)TWO(5x7)SEVEN')
     self.assertEqual(445, output)
Esempio n. 11
0
 def test_example_1(self):
     output = Decompressor().get_decompressed_length('ADVENT')
     self.assertEqual(6, output)
Esempio n. 12
0
 def test_example_2c(self):
     output = Decompressor().get_decompressed_length_v2(
         '(27x12)(20x12)(13x14)(7x10)(1x12)A')
     self.assertEqual(241920, output)
Esempio n. 13
0
 def test_example_2b(self):
     output = Decompressor().get_decompressed_length_v2('X(8x2)(3x3)ABCY')
     self.assertEqual(20, output)
Esempio n. 14
0
 def test_example_1b(self):
     output = Decompressor().get_decompressed_length_v2('(3x3)XYZ')
     self.assertEqual(9, output)
Esempio n. 15
0
 def test_partOne(self):
   decompressor = Decompressor()
   f = open('input.txt', 'r')
   compressedString = f.readline()
   f.close()
   print("\nPart One - Length of decompressed String: %s" % decompressor.calculateUncompressedLength(compressedString))
Esempio n. 16
0
from Decompressor import Decompressor

inputFile = open('D9.txt', 'r')
inputString = inputFile.readline()

decomp = Decompressor(inputString.replace('\n', ''), True)
decomp.decompress()
print(decomp.count)
Esempio n. 17
0
 def test_v1NoCompression(self):
   decompressor = Decompressor()
   self.assertEqual(decompressor.calculateUncompressedLength('ADVENT'), 6)
Esempio n. 18
0
 def test_example_4(self):
     output = Decompressor().get_decompressed_length('A(2x2)BCD(2x2)EFG')
     self.assertEqual(11, output)