# -*- coding: utf-8 -*-

# Copyright (c) 2012, Sergio Callegari
# All rights reserved.

# This file is part of PyDSM.

# PyDSM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# PyDSM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with PyDSM.  If not, see <https://www.gnu.org/licenses/>.

from __future__ import division, print_function

import numpy as np
from pydsm.ft import dtft, dtft_hermitian, idtft, idtft_hermitian

__all__ = ["TestDTFT"]


class TestDTFT:

    def setUp(self):
        pass

    def test_dtft_re10(self):
        xx = np.arange(1, 11)
        Ff = dtft(xx)
        xx2 = idtft(Ff, np.arange(10))
        np.testing.assert_allclose(xx, xx2, atol=1E-12)

    def test_dtft_re10s1(self):
        xx = np.arange(1, 11)
        Ff = dtft_hermitian(xx)
        xx2 = idtft(Ff, np.arange(10))
        np.testing.assert_allclose(xx, xx2, atol=1E-12)

    def test_dtft_re10s2(self):
        xx = np.arange(1, 11)
        Ff = dtft_hermitian(xx)
        xx2 = idtft_hermitian(Ff, np.arange(10))
        np.testing.assert_allclose(xx, xx2, atol=1E-12)
