{-|
    Module      :  Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Tests.Reduce
    Description :  (testing) properties of reduction operations
    Copyright   :  (c) 2007-2008 Michal Konecny
    License     :  BSD3

    Maintainer  :  mik@konecny.aow.cz
    Stability   :  experimental
    Portability :  portable
    
    Quickcheck properties of operations that reduce the size of polynomials.
-}
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Tests.Reduce
where

import Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Reduce
import Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Basic
import Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Tests.Generate

import Test.QuickCheck

prop_chplReduceTermCount_consistent (PSize30 (_,p), Deg20Size20 _ maxSize) =
    maxSize < chplCountTerms p ==>
    chplAtKeyPointsCanBeLeq p pUp
    && 
    chplAtKeyPointsCanBeLeq pDown p
    where
    (pDown, pUp) = chplReduceTermCount maxSize p 
    

prop_chplReduceDegree_consistent (PSize30 (_,p), Deg20Size20 maxDegree _) =
    maxDegree < chplGetDegree p ==>
    chplAtKeyPointsCanBeLeq p pUp
    && 
    chplAtKeyPointsCanBeLeq pDown p
    where
    (pDown, pUp) = chplReduceDegree maxDegree p