module Test.SDP.Ord
(
TestOrd, ordTest,
lexicographicOrdTest
)
where
import Prelude ()
import SDP.SafePrelude
import SDP.Linear
default ()
type TestOrd l = l -> l -> l -> Bool
ordTest :: (Ord l) => l -> l -> l -> Bool
ordTest :: l -> l -> l -> Bool
ordTest l
xs l
ys l
zs = [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and
[
(l
xs l -> l -> Bool
forall a. Ord a => a -> a -> Bool
<= l
ys Bool -> Bool -> Bool
&& l
ys l -> l -> Bool
forall a. Ord a => a -> a -> Bool
<= l
xs) Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= (l
xs l -> l -> Bool
forall a. Eq a => a -> a -> Bool
== l
ys),
(l
xs l -> l -> Bool
forall a. Ord a => a -> a -> Bool
<= l
ys Bool -> Bool -> Bool
&& l
ys l -> l -> Bool
forall a. Ord a => a -> a -> Bool
<= l
zs) Bool -> Bool -> Bool
forall a. Ord a => a -> a -> Bool
<= (l
xs l -> l -> Bool
forall a. Ord a => a -> a -> Bool
<= l
zs),
(l
xs l -> l -> Bool
forall a. Ord a => a -> a -> Bool
<= l
ys) Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
/= (l
xs l -> l -> Bool
forall a. Ord a => a -> a -> Bool
> l
ys)
]
lexicographicOrdTest :: (Linear l e, Ord l, Ord e) => l -> l -> Bool
lexicographicOrdTest :: l -> l -> Bool
lexicographicOrdTest l
xs l
ys = (l
xs Compare l
forall o. Ord o => Compare o
<=> l
ys) Ordering -> Ordering -> Bool
forall a. Eq a => a -> a -> Bool
== (l -> [e]
forall l e. Linear l e => l -> [e]
listL l
xs Compare [e]
forall o. Ord o => Compare o
<=> l -> [e]
forall l e. Linear l e => l -> [e]
listL l
ys)