@@ -539,6 +539,32 @@ spec = do
539539 <> show simplifiedSimpleSystemEval
540540 ) $
541541 simpleSystemEval == simplifiedSimpleSystemEval
542+ it " findHighestVar finds the highest variable in a simple system" $ do
543+ let simpleSystem1 =
544+ [ Expr (VarTerm 0 ) :>= 0
545+ , Expr (VarTerm 0 ) :<= 1
546+ , Expr (VarTerm 1 ) :>= 0
547+ , Expr (VarTerm 1 ) :<= 1
548+ ]
549+ simpleSystem100 =
550+ [ Expr (VarTerm 0 ) :<= 1
551+ , Expr (VarTerm 50 ) :<= 1
552+ , Expr (VarTerm 100 ) :<= 1
553+ ]
554+ simpleSystem10 =
555+ [ Expr (VarTerm (- 10 )) :<= 1
556+ , Expr (VarTerm 0 ) :<= 1
557+ , Expr (VarTerm 10 ) :<= 1
558+ ]
559+ simpleSystemMinus10 =
560+ [ Expr (VarTerm (- 10 )) :<= 1
561+ , Expr (VarTerm (- 20 )) :<= 1
562+ ]
563+
564+ findHighestVar simpleSystem1 `shouldBe` 1
565+ findHighestVar simpleSystem100 `shouldBe` 100
566+ findHighestVar simpleSystem10 `shouldBe` 10
567+ findHighestVar simpleSystemMinus10 `shouldBe` (- 10 )
542568 describe " Bounds" $ do
543569 it " validateBounds finds that deriving bounds for a system where -1 <= x <= 1 has valid bounds" $ do
544570 let simpleSystem =
@@ -691,4 +717,3 @@ spec = do
691717 simplifiedSimpleSystem = removeUselessSystemBounds simpleSystem bounds
692718 expectedSimpleSystem = [Expr (VarTerm 0 ) :<= 2 , Expr (CoeffTerm 2 0 ) :<= 6 ]
693719 simplifiedSimpleSystem `shouldBe` expectedSimpleSystem
694-
0 commit comments