MCPcopy Create free account
hub / github.com/OpenMined/TenSEAL / test_intarray

Function test_intarray

tests/python/sealapi/test_sanity.py:79–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77
78
79def test_intarray():
80 testcase = sealapi.Plaintext("3x^3 + 1x^1 + 3")
81 int_arr = testcase.dyn_array()
82
83 assert int_arr[0] == 3
84 assert int_arr.at(3) == 3
85 assert int_arr.empty() is False
86 assert int_arr.max_size() == 2**64 - 1
87 assert int_arr.size() == 4
88 assert int_arr.capacity() == 4
89
90 def save_load(path):
91 int_arr.save(path)
92 save_test = sealapi.DynArray()
93 save_test.load(path)
94 assert save_test[0] == 3
95
96 tmp_file(save_load)
97
98 int_arr.resize(10, True)
99 assert int_arr.capacity() == 10
100 assert int_arr.size() == 10
101
102 int_arr.reserve(30)
103 assert int_arr.capacity() == 30
104 assert int_arr.capacity() == 30
105
106 int_arr.shrink_to_fit()
107 assert int_arr.capacity() == 10
108 assert int_arr.size() == 10
109
110 int_arr.clear()
111 assert int_arr.size() == 0
112 assert int_arr.capacity() == 10
113 assert int_arr.empty() is True
114
115 int_arr.release()
116 assert int_arr.capacity() == 0
117
118
119def test_plaintext():

Callers

nothing calls this directly

Calls 5

tmp_fileFunction · 0.85
atMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected