module Test.Ganeti.Constants (testConstants) where
import Test.HUnit (Assertion)
import qualified Test.HUnit as HUnit
import qualified Ganeti.Constants as Constants
import qualified Ganeti.ConstantUtils as ConstantUtils
import qualified Test.Ganeti.TestHelper as TestHelper
case_buildVersion :: Assertion
case_buildVersion = do
HUnit.assertBool "Config major lower-bound violation"
(Constants.configMajor >= 0)
HUnit.assertBool "Config major upper-bound violation"
(Constants.configMajor <= 99)
HUnit.assertBool "Config minor lower-bound violation"
(Constants.configMinor >= 0)
HUnit.assertBool "Config minor upper-bound violation"
(Constants.configMinor <= 99)
HUnit.assertBool "Config revision lower-bound violation"
(Constants.configRevision >= 0)
HUnit.assertBool "Config revision upper-bound violation"
(Constants.configRevision <= 9999)
HUnit.assertBool "Config version lower-bound violation"
(Constants.configVersion >= 0)
HUnit.assertBool "Config version upper-bound violation"
(Constants.configVersion <= 99999999)
HUnit.assertEqual "Build version"
(ConstantUtils.buildVersion 0 0 0) 0
HUnit.assertEqual "Build version"
(ConstantUtils.buildVersion 10 10 1010) 10101010
HUnit.assertEqual "Build version"
(ConstantUtils.buildVersion 12 34 5678) 12345678
HUnit.assertEqual "Build version"
(ConstantUtils.buildVersion 99 99 9999) 99999999
HUnit.assertEqual "Build version"
(ConstantUtils.buildVersion
Constants.configMajor
Constants.configMinor
Constants.configRevision) Constants.configVersion
HUnit.assertEqual "Build version"
(ConstantUtils.buildVersion
Constants.configMajor
Constants.configMinor
Constants.configRevision) Constants.protocolVersion
TestHelper.testSuite "Constants"
[ 'case_buildVersion
]