module Test.Overlap where

import qualified Numeric.Interpolation.Type as Type

import Test.QuickCheck (quickCheck, )



test :: Type.T Double y ny -> IO ()
test typ =
   quickCheck $ \xs xi ->
      let samples = map fst $ Type.sampleBasisFunctions typ xs xi
          {- not total:
          maximum samples - minimum samples < Type.basisOverlap typ
          -}
      in  all (< minimum samples + Type.basisOverlap typ) samples


tests :: [(String, IO ())]
tests =
   ("linear", test Type.linear) :
   ("hermite1", test Type.hermite1) :
   ("cubicLinear", test Type.cubicLinear) :
   ("cubicParabola", test Type.cubicParabola) :
   []