Пример #1
0
 def test_generate_stacked_transform(self):
     """
     This method tests the stacked transformation generation of identity and shift with predefined input and output.
     """
     test_array = array([
         [1, -1, 1, -1],
         [-1, -1, 1, -1],
     ],
                        dtype=tools.BIT_TYPE)
     assert_array_equal(
         LTFArray.generate_stacked_transform(
             transform_1=LTFArray.transform_id,
             puf_count=2,
             transform_2=LTFArray.transform_shift)(test_array, k=4), [
                 [
                     [1, -1, 1, -1],
                     [1, -1, 1, -1],
                     [1, -1, 1, -1],
                     [-1, 1, -1, 1],
                 ],
                 [
                     [-1, -1, 1, -1],
                     [-1, -1, 1, -1],
                     [-1, -1, 1, -1],
                     [-1, 1, -1, -1],
                 ],
             ])
Пример #2
0
 def test_transform_stack(self):
     test_array = array([
         [1, -1, 1, -1],
         [-1, -1, 1, -1],
     ])
     assert_array_equal(
         LTFArray.generate_stacked_transform(
             transform_1=LTFArray.transform_id,
             kk=2,
             transform_2=LTFArray.transform_shift)(test_array, k=4), [
                 [
                     [1, -1, 1, -1],
                     [1, -1, 1, -1],
                     [1, -1, 1, -1],
                     [-1, 1, -1, 1],
                 ],
                 [
                     [-1, -1, 1, -1],
                     [-1, -1, 1, -1],
                     [-1, -1, 1, -1],
                     [-1, 1, -1, -1],
                 ],
             ])