def test_randomgen(factory): assert sealapi.random_uint64() != sealapi.random_uint64() for generator in [ factory.create(), factory.create([sealapi.random_uint64() for i in range(8)]), ]: assert generator.generate() != generator.generate() adapter = sealapi.RandomToStandardAdapter(generator) assert adapter() != adapter() for i in range(1024): generator.refresh() generator.generate()
sealapi.Serialization.SaveHeader(header, path) save_test = sealapi.Serialization.SEALHeader() sealapi.Serialization.LoadHeader(path, save_test, True) assert save_test.compr_mode == sealapi.COMPR_MODE_TYPE.ZLIB sealapi.Serialization.LoadHeader(path, save_test, False) assert save_test.compr_mode == sealapi.COMPR_MODE_TYPE.ZLIB tmp_file(save_load) @pytest.mark.parametrize( "factory", [ sealapi.Blake2xbPRNGFactory.DefaultFactory(), sealapi.Blake2xbPRNGFactory(), sealapi.Blake2xbPRNGFactory([sealapi.random_uint64() for i in range(8)]), sealapi.Shake256PRNGFactory.DefaultFactory(), sealapi.Shake256PRNGFactory(), sealapi.Shake256PRNGFactory([sealapi.random_uint64() for i in range(8)]), ], ) def test_randomgen(factory): assert sealapi.random_uint64() != sealapi.random_uint64() for generator in [ factory.create(), factory.create([sealapi.random_uint64() for i in range(8)]), ]: assert generator.generate() != generator.generate() adapter = sealapi.RandomToStandardAdapter(generator)
tmp = NamedTemporaryFile() sealapi.Serialization.SaveHeader(header, tmp.name) save_test = sealapi.Serialization.SEALHeader() sealapi.Serialization.LoadHeader(tmp.name, save_test, True) assert save_test.compr_mode == sealapi.COMPR_MODE_TYPE.DEFLATE sealapi.Serialization.LoadHeader(tmp.name, save_test, False) assert save_test.compr_mode == sealapi.COMPR_MODE_TYPE.DEFLATE @pytest.mark.parametrize( "factory", [ sealapi.BlakePRNGFactory.DefaultFactory(), sealapi.BlakePRNGFactory(), sealapi.BlakePRNGFactory([sealapi.random_uint64() for i in range(8)]), ], ) def test_randomgen(factory): assert sealapi.random_uint64() != sealapi.random_uint64() for generator in [ factory.create(), factory.create([sealapi.random_uint64() for i in range(8)]), ]: assert generator.generate() != generator.generate() adapter = sealapi.RandomToStandardAdapter(generator) assert adapter() != adapter() for i in range(1024):