2024-06-11 18:09:08 +02:00

15 lines
536 B
Python

from unittest import TestCase
from da.kzg_rs.roots import compute_roots_of_unity
from da.kzg_rs.common import BLS_MODULUS
from fft import fft, ifft
class TestFFT(TestCase):
def test_fft_ifft(self):
for size in [16, 32, 64, 128, 256, 512, 1024, 2048, 4096]:
roots_of_unity = compute_roots_of_unity(2, size, BLS_MODULUS)
vals = list(x for x in range(size))
vals_fft = fft(vals, roots_of_unity, BLS_MODULUS)
self.assertEqual(vals, ifft(vals_fft, roots_of_unity, BLS_MODULUS))