def test_stream_in_out(): test_name = "test_stream_in_out" ts = datagen.gen_random_ints(100) vals = datagen.gen_random_ints(100) d = datagen.serialize(ts,vals) filepath = "tmp/"+test_name+".pkd.bin" pack(d, filepath) output = unpack(filepath) assert output == d, test_name + " failed"
def test_file_output(): test_name = "test_file_output" ts = datagen.gen_random_ints(100) vals = datagen.gen_random_ints(100) d = datagen.serialize(ts,vals) filepath = "tmp/"+test_name+".pkd.bin" outfile= "tmp/"+test_name+".out" pack(d, filepath) unpackToFile(filepath, outfile) with open(outfile) as f: output = f.read() assert output == d, test_name + " failed"
def test_file_input(): test_name = "test_file_input" ts = datagen.gen_random_ints(100) vals = datagen.gen_random_ints(100) d = datagen.serialize(ts,vals) infile = "tmp/"+test_name+".bin" filepath = "tmp/"+test_name+".pkd.bin" with open(infile,'w') as f: f.write(d) packFromFile(infile, filepath) output = unpack(filepath) with open(infile,'r') as f: dfile = f.read() assert output == dfile, test_name + " failed"
def test_large(): ts = datagen.gen_interval(200000, 300, 1000000) vals = datagen.gen_random_ints(200000) test_pack(ts,vals,"large")