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

    Maintainer  :  mik@konecny.aow.cz
    Stability   :  experimental
    Portability :  portable
    
    Quickcheck properties of bounding operations, ie constant bounds and binary min/max.
-}
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Tests.Bounds
where

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

import Data.Number.ER.BasicTypes

import Test.QuickCheck

prop_chplBounds_consistent (ixI, PSize30 (_,p)) =
    ixI >= 2 ==>
    ixI < 100 ==>
    chplAtKeyPointsCanBeLeq p pHigh
    &&
    chplAtKeyPointsCanBeLeq pLow p
    where
    pLow = chplConst cLow
    pHigh = chplConst cHigh
    (cLow, cHigh) = chplBounds ix p
    ix = int2effIx ixI

prop_chplMax_consistent 
        (Deg20Size20 maxDegree maxSize, PSize30 (_,p1), PSize30 (_, p2)) =
    chplAtKeyPointsPointwiseBinaryDownUpConsistent max p1 p2 (maxLow, maxHigh)
    where
    (maxLow, maxHigh) = chplMax maxDegree maxSize p1 p2

prop_chplMin_consistent (Deg20Size20 maxDegree maxSize, PSize30 (_,p1), PSize30 (_, p2)) =
    chplAtKeyPointsPointwiseBinaryDownUpConsistent min p1 p2 (minLow, minHigh)
    where
    (minLow, minHigh) = chplMin maxDegree maxSize p1 p2