-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.IT.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.IT.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "IT Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.JA.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.JA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "JA Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.KA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.KA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KA Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.KM.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.KM.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KM Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


--Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.KN.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.KN.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KN Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.KO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.KO.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KO Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.LO.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.LO.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "LO Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.ML.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.ML.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ML Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.MN.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.MN.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "MN Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.MY.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.MY.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "MY Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.NB.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.NB.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "NB Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


--Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.NE.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.NE.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "NE Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.NL.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.NL.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "NL Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.PL.Tests
  ( tests ) where

import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.PL.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "PL Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.PT.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.PT.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "PT Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.RO.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.Locale
import Duckling.Numeral.RO.Corpus
import Duckling.Resolve
import Duckling.Testing.Asserts
import Duckling.Testing.Types

tests :: TestTree
tests = testGroup "RO Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  , intersectTests
  ]

intersectTests :: TestTree
intersectTests = testCase "Intersect Test" $
  mapM_ (analyzedNTest context testOptions . withTargets [Seal Numeral])
    [ ("19 de milioane", 2) -- make sure ruleMultiplyDe only takes >= 20
    ]
  where
    context = testContext {locale = makeLocale RO Nothing}


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.RU.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.RU.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "RU Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.

module Duckling.Numeral.SK.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.SK.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "SK Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.SV.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.SV.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "SV Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.SW.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.SW.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "SW Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.TA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.TA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "TA Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.TE.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.TE.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "TE Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.TH.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.TH.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "TH Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.TR.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.TR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "TR Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.UK.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.UK.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "UK Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.VI.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.VI.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "VI Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Numeral.ZH.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Numeral.ZH.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ZH Tests"
  [ makeCorpusTest [Seal Numeral] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.Tests (tests) where

import Data.String
import Test.Tasty

import qualified Duckling.Ordinal.AR.Tests as AR
import qualified Duckling.Ordinal.BG.Tests as BG
import qualified Duckling.Ordinal.CA.Tests as CA
import qualified Duckling.Ordinal.DA.Tests as DA
import qualified Duckling.Ordinal.DE.Tests as DE
import qualified Duckling.Ordinal.EL.Tests as EL
import qualified Duckling.Ordinal.EN.Tests as EN
import qualified Duckling.Ordinal.ES.Tests as ES
import qualified Duckling.Ordinal.ET.Tests as ET
import qualified Duckling.Ordinal.FR.Tests as FR
import qualified Duckling.Ordinal.GA.Tests as GA
import qualified Duckling.Ordinal.HE.Tests as HE
import qualified Duckling.Ordinal.HI.Tests as HI
import qualified Duckling.Ordinal.HR.Tests as HR
import qualified Duckling.Ordinal.HU.Tests as HU
import qualified Duckling.Ordinal.ID.Tests as ID
import qualified Duckling.Ordinal.IT.Tests as IT
import qualified Duckling.Ordinal.JA.Tests as JA
import qualified Duckling.Ordinal.KA.Tests as KA
import qualified Duckling.Ordinal.KM.Tests as KM
import qualified Duckling.Ordinal.KO.Tests as KO
import qualified Duckling.Ordinal.MN.Tests as MN
import qualified Duckling.Ordinal.ML.Tests as ML
import qualified Duckling.Ordinal.NB.Tests as NB
import qualified Duckling.Ordinal.NL.Tests as NL
import qualified Duckling.Ordinal.PL.Tests as PL
import qualified Duckling.Ordinal.PT.Tests as PT
import qualified Duckling.Ordinal.RO.Tests as RO
import qualified Duckling.Ordinal.RU.Tests as RU
import qualified Duckling.Ordinal.SV.Tests as SV
import qualified Duckling.Ordinal.TA.Tests as TA
import qualified Duckling.Ordinal.TR.Tests as TR
import qualified Duckling.Ordinal.UK.Tests as UK
import qualified Duckling.Ordinal.VI.Tests as VI
import qualified Duckling.Ordinal.ZH.Tests as ZH

tests :: TestTree
tests = testGroup "Ordinal Tests"
  [ AR.tests
  , BG.tests
  , CA.tests
  , DA.tests
  , DE.tests
  , EL.tests
  , EN.tests
  , ES.tests
  , ET.tests
  , FR.tests
  , GA.tests
  , HE.tests
  , HI.tests
  , HR.tests
  , HU.tests
  , ID.tests
  , IT.tests
  , JA.tests
  , KA.tests
  , KM.tests
  , KO.tests
  , MN.tests
  , ML.tests
  , NB.tests
  , NL.tests
  , PL.tests
  , PT.tests
  , RO.tests
  , RU.tests
  , SV.tests
  , TA.tests
  , TR.tests
  , UK.tests
  , VI.tests
  , ZH.tests
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.AR.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.AR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "AR Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.BG.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.BG.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "BG Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.CA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.CA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "CA Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.DA.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.DA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "DA Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.DE.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.DE.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "DE Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  , makeNegativeCorpusTest [Seal Ordinal] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.EL.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.EL.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "EL Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.EN.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.EN.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "EN Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.ES.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.ES.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ES Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.ET.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.ET.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ET Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.FR.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.FR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "FR Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.GA.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.GA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "GA Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.HE.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.HE.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HE Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.HI.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.HI.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HI Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.HR.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.HR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HR Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.HU.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.HU.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HU Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.ID.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.ID.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ID Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.IT.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.IT.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "IT Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.JA.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.JA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "JA Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.KA.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.KA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KA Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.KM.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.KM.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KM Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.KO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.KO.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KO Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.ML.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.ML.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ML Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.MN.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.MN.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "MN Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.NB.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.NB.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "NB Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.NL.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.NL.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "NL Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.PL.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.PL.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "PL Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.PT.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.PT.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "PT Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.RO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.RO.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "RO Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.RU.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.RU.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "RU Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.SV.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.SV.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "SV Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.TA.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.TA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "TA Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.TR.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.TR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "TR Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.UK.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.UK.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "UK Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.VI.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.VI.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "VI Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Ordinal.ZH.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Ordinal.ZH.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ZH Tests"
  [ makeCorpusTest [Seal Ordinal] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

{-# LANGUAGE OverloadedStrings #-}

module Duckling.PhoneNumber.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.PhoneNumber.Corpus
import Duckling.PhoneNumber.Types
import Duckling.Testing.Asserts
import Duckling.Testing.Types
import qualified Duckling.PhoneNumber.AR.Tests as AR
import qualified Duckling.PhoneNumber.PT.Tests as PT

tests :: TestTree
tests = testGroup "PhoneNumber Tests"
  [ makeCorpusTest [Seal PhoneNumber] corpus
  , makeNegativeCorpusTest [Seal PhoneNumber] negativeCorpus
  , surroundTests
  , PT.tests
  , AR.tests
  ]

surroundTests :: TestTree
surroundTests = testCase "Surround Tests" $
  mapM_ (analyzedFirstTest testContext testOptions .
    withTargets [Seal PhoneNumber]) xs
  where
    xs = examples (PhoneNumberValue "06354640807")
                  [ "hey 06354640807"
                  , "06354640807 hey"
                  , "hey 06354640807 hey"
                  ]
         ++ examples (PhoneNumberValue "18998078030")
                     [ "a 18998078030 b"
                     ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.PhoneNumber.AR.Tests
  ( tests
  ) where

import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.PhoneNumber.AR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "PhoneNumber Tests"
  [ makeCorpusTest [Seal PhoneNumber] corpus
  , makeNegativeCorpusTest [Seal PhoneNumber] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.PhoneNumber.PT.Tests
  ( tests
  ) where

import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.PhoneNumber.PT.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "PhoneNumber Tests"
  [ makeCorpusTest [Seal PhoneNumber] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.Tests
  ( tests
  ) where

import Data.String
import Test.Tasty

import qualified Duckling.Quantity.AR.Tests as AR
import qualified Duckling.Quantity.EN.Tests as EN
import qualified Duckling.Quantity.ES.Tests as ES
import qualified Duckling.Quantity.FR.Tests as FR
import qualified Duckling.Quantity.HR.Tests as HR
import qualified Duckling.Quantity.KM.Tests as KM
import qualified Duckling.Quantity.KO.Tests as KO
import qualified Duckling.Quantity.MN.Tests as MN
import qualified Duckling.Quantity.NL.Tests as NL
import qualified Duckling.Quantity.PT.Tests as PT
import qualified Duckling.Quantity.RO.Tests as RO
import qualified Duckling.Quantity.RU.Tests as RU
import qualified Duckling.Quantity.ZH.Tests as ZH

tests :: TestTree
tests = testGroup "Quantity Tests"
  [ AR.tests
  , EN.tests
  , ES.tests
  , FR.tests
  , HR.tests
  , KM.tests
  , KO.tests
  , MN.tests
  , NL.tests
  , PT.tests
  , RO.tests
  , RU.tests
  , ZH.tests
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.AR.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.AR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "AR Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.EN.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.EN.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "EN Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  , makeCorpusTest [Seal Quantity] latentCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.ES.Tests
  ( tests
  ) where

import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.ES.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ES Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.FR.Tests
  ( tests ) where
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.FR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "FR Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.HR.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.HR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HR Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.KM.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.KM.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KM Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.KO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.KO.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KO Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.MN.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.MN.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "MN Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.NL.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.NL.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "NL Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.PT.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.PT.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "PT Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.RO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.RO.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "RO Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.RU.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.RU.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "RU Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Quantity.ZH.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Quantity.ZH.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ZH Tests"
  [ makeCorpusTest [Seal Quantity] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.Tests (tests) where

import Prelude
import Data.String
import Test.Tasty

import qualified Duckling.Temperature.AR.Tests as AR
import qualified Duckling.Temperature.CA.Tests as CA
import qualified Duckling.Temperature.EN.Tests as EN
import qualified Duckling.Temperature.ES.Tests as ES
import qualified Duckling.Temperature.FR.Tests as FR
import qualified Duckling.Temperature.GA.Tests as GA
import qualified Duckling.Temperature.HI.Tests as HI
import qualified Duckling.Temperature.HR.Tests as HR
import qualified Duckling.Temperature.IT.Tests as IT
import qualified Duckling.Temperature.JA.Tests as JA
import qualified Duckling.Temperature.KM.Tests as KM
import qualified Duckling.Temperature.KO.Tests as KO
import qualified Duckling.Temperature.MN.Tests as MN
import qualified Duckling.Temperature.PT.Tests as PT
import qualified Duckling.Temperature.RO.Tests as RO
import qualified Duckling.Temperature.TR.Tests as TR
import qualified Duckling.Temperature.ZH.Tests as ZH

tests :: TestTree
tests = testGroup "Temperature Tests"
  [ AR.tests
  , CA.tests
  , EN.tests
  , ES.tests
  , FR.tests
  , GA.tests
  , HI.tests
  , HR.tests
  , IT.tests
  , JA.tests
  , KM.tests
  , KO.tests
  , MN.tests
  , PT.tests
  , RO.tests
  , TR.tests
  , ZH.tests
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.AR.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.AR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "AR Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.CA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Temperature.CA.Corpus
import Duckling.Dimensions.Types
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "CA Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.EN.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.Temperature.EN.Corpus
import Duckling.Testing.Asserts
import Duckling.Testing.Types (testContext, testOptions)
import Duckling.Types (Range(..))

tests :: TestTree
tests = testGroup "EN Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  , rangeTests
  ]

rangeTests :: TestTree
rangeTests = testCase "Range Test" $
  mapM_ (analyzedRangeTest testContext testOptions
          . withTargets [Seal Temperature]) xs
  where
    xs = [ ("between 40 and 30 degrees", Range 15 25 )
         , ("30 degrees degrees", Range 0 10 )
         ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.ES.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.ES.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ES Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.FR.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.FR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "FR Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.GA.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.GA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "GA Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.HI.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.HI.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HI Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.HR.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.HR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HR Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.IT.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.IT.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "IT Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.JA.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.JA.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "JA Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.KM.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.KM.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KM Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.KO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.KO.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "KO Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.MN.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.MN.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "MN Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.PT.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.PT.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "PT Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.RO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.RO.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "RO Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.TR.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.TR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "TR Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Temperature.ZH.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Temperature.ZH.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "ZH Tests"
  [ makeCorpusTest [Seal Temperature] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

{-# LANGUAGE TupleSections #-}

module Duckling.Testing.Asserts
  ( analyzedTargetTest
  , analyzedFirstTest
  , analyzedAmbiguousTest
  , analyzedNTest
  , analyzedNothingTest
  , analyzedRangeTest
  , makeCorpusTest
  , makeNegativeCorpusTest
  , withTargets
  ) where

import Data.List (partition)
import Data.String
import Data.Text (Text)
import Prelude
import Test.Tasty
import Test.Tasty.HUnit
import qualified Data.HashSet as HashSet
import qualified Data.Text as Text

import Duckling.Api
import Duckling.Dimensions.Types
import Duckling.Resolve
import Duckling.Testing.Types
import Duckling.Types

newtype ExampleInput = ExampleInput Text

instance Show ExampleInput where
  show (ExampleInput input) = "\"" ++ Text.unpack input ++ "\""

withTargets :: [Seal Dimension] -> (Text, a) -> (Text, [Seal Dimension], a)
withTargets targets (input, expected) = (input, targets, expected)

analyzedTargetTest :: Context -> Options -> (Text, Seal Dimension) -> IO ()
analyzedTargetTest context options (input, target) =
  assertBool msg $ all (== target) dimensions
  where
    msg = "analyze " ++ show (ExampleInput input, [target])
          ++ "dimensions = " ++ show dimensions
    dimensions = flip map (analyze input context options $ HashSet.singleton target) $
      \(Resolved{node=Node{token=Token dimension _}}) -> Seal dimension

analyzedFirstTest :: Context -> Options ->
  (Text, [Seal Dimension], TestPredicate) -> IO ()
analyzedFirstTest context options (input, targets, predicate) =
  case tokens of
    [] -> assertFailure
      ("empty result on " ++ show (ExampleInput input, targets))
    (token:_) -> assertBool
      ("don't pass predicate on " ++ show (ExampleInput input)) $
      predicate context token
    where
      tokens = analyze input context options $ HashSet.fromList targets

analyzedAmbiguousTest :: Context -> Options ->
  (Text, [Seal Dimension], [TestPredicate]) -> IO ()
analyzedAmbiguousTest context options (input, targets, predicates) =
  case tokens of
    [] -> assertFailure
      ("empty result on " ++ show (ExampleInput input, targets))
    _ -> assertBool ("don't pass predicate on " ++ show (ExampleInput input)) $
      all (\predicate -> any (predicate context) tokens) predicates
    where
      tokens = analyze input context options $ HashSet.fromList targets

makeCorpusTest :: [Seal Dimension] -> Corpus -> TestTree
makeCorpusTest targets (context, options, xs) = testCase "Corpus Tests" $
  mapM_ check xs
  where
    dims = HashSet.fromList targets
    check :: Example -> IO ()
    check (input, predicate) =
      let tokens = analyze input context options dims in
      let inputRange = Range 0 $ Text.length input in
      let (fullRangeTokens, restTokens) =
            partition ((== inputRange) . range) tokens in
      case fullRangeTokens of
        [] -> case restTokens of
          [] -> assertFailure $ "empty result on " ++ show (ExampleInput input)
          (_:_:_) -> assertFailure $
            show (length restTokens) ++
            " tokens found for " ++
            show (ExampleInput input)
          _ -> assertFailure $ "don't fully match " ++ show (ExampleInput input)
        [token] -> assertBool
          ("don't pass predicate on " ++ show (ExampleInput input)) $
          predicate context token
        _ -> assertFailure $ show (length fullRangeTokens)
          ++ " different ambiguous parses on " ++ show (ExampleInput input)

makeNegativeCorpusTest :: [Seal Dimension] -> NegativeCorpus -> TestTree
makeNegativeCorpusTest targets (context, options, xs) =
  testCase "Negative Corpus Tests"
  $ mapM_ (analyzedNothingTest context options . (, targets)) xs

analyzedRangeTest :: Context -> Options -> (Text, [Seal Dimension], Range)
  -> IO ()
analyzedRangeTest context options  (input, targets, expRange) = case tokens of
  [] -> assertFailure $ "empty result on " ++ show (ExampleInput input)
  (_:_:_) -> assertFailure $
    show (length tokens) ++ " tokens found for " ++ show (ExampleInput input)
  (token:_) ->
    assertEqual ("wrong range for " ++ show (ExampleInput input))
    expRange (range token)
  where
    tokens = analyze input context options $ HashSet.fromList targets

analyzedNothingTest :: Context -> Options -> (Text, [Seal Dimension]) -> IO ()
analyzedNothingTest context options (input, targets) =
  analyzedNTest context options (input, targets, 0)

analyzedNTest :: Context -> Options -> (Text, [Seal Dimension], Int) -> IO ()
analyzedNTest context options (input, targets, n) =
  assertBool msg . (== n) $ length tokens
  where
    msg = "analyze " ++ show (ExampleInput input, targets)
          ++ "tokens= " ++ show tokens
    tokens = analyze input context options $ HashSet.fromList targets


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

{-# LANGUAGE OverloadedStrings #-}

module Duckling.Time.Tests (tests) where

import Data.Aeson
import Data.Aeson.Types ((.:), parseMaybe, withObject)
import Data.String
import Data.Text (Text)
import Data.Time
import Prelude
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Testing.Types
import Duckling.Time.Types
import Duckling.TimeGrain.Types
import qualified Duckling.Time.AR.Tests as AR
import qualified Duckling.Time.BG.Tests as BG
import qualified Duckling.Time.CA.Tests as CA
import qualified Duckling.Time.DA.Tests as DA
import qualified Duckling.Time.DE.Tests as DE
import qualified Duckling.Time.EN.Tests as EN
import qualified Duckling.Time.EL.Tests as EL
import qualified Duckling.Time.ES.Tests as ES
import qualified Duckling.Time.FR.Tests as FR
import qualified Duckling.Time.GA.Tests as GA
import qualified Duckling.Time.HR.Tests as HR
import qualified Duckling.Time.HE.Tests as HE
import qualified Duckling.Time.HU.Tests as HU
import qualified Duckling.Time.IT.Tests as IT
import qualified Duckling.Time.JA.Tests as JA
import qualified Duckling.Time.KA.Tests as KA
import qualified Duckling.Time.KO.Tests as KO
import qualified Duckling.Time.NB.Tests as NB
import qualified Duckling.Time.NL.Tests as NL
import qualified Duckling.Time.PL.Tests as PL
import qualified Duckling.Time.PT.Tests as PT
import qualified Duckling.Time.RO.Tests as RO
import qualified Duckling.Time.RU.Tests as RU
import qualified Duckling.Time.SV.Tests as SV
import qualified Duckling.Time.TR.Tests as TR
import qualified Duckling.Time.UK.Tests as UK
import qualified Duckling.Time.VI.Tests as VI
import qualified Duckling.Time.ZH.Tests as ZH

tests :: TestTree
tests = testGroup "Time Tests"
  [ AR.tests
  , BG.tests
  , CA.tests
  , DA.tests
  , DE.tests
  , EL.tests
  , EN.tests
  , ES.tests
  , FR.tests
  , GA.tests
  , HR.tests
  , HE.tests
  , HU.tests
  , IT.tests
  , JA.tests
  , KA.tests
  , KO.tests
  , NB.tests
  , NL.tests
  , PL.tests
  , PT.tests
  , RO.tests
  , RU.tests
  , SV.tests
  , TR.tests
  , UK.tests
  , VI.tests
  , ZH.tests
  , timeFormatTest
  , timeIntersectTest
  ]

timeFormatTest :: TestTree
timeFormatTest = testCase "Format Test" $
  mapM_ (analyzedFirstTest testContext testOptions . withTargets [Seal Time]) xs
  where
    xs = examplesCustom (parserCheck expected parseValue) ["now"]
    expected = "2013-02-12T04:30:00.000-02:00"

parseValue :: Value -> Maybe Text
parseValue = parseMaybe . withObject "value object" $ \o -> o .: "value"

timeIntersectTest :: TestTree
timeIntersectTest = testCase "Intersect Test" $ mapM_ check
  [ ((t01, t01), Just t01)
  , ((t01, t12), Nothing)
  , ((t12, t13), Just t12)
  , ((t12, t34), Nothing)
  , ((t13, t23), Just t23)
  , ((t13, t24), Just t23)
  , ((t0_, t0_), Just t0_)
  , ((t0_, t1_), Nothing)
  , ((t0_, t01), Just t01)
  , ((t0_, t13), Nothing)
  , ((t0_, t2_), Nothing)
  , ((t0m, t13), Just t13)

  , ((t12, t01), Nothing)
  , ((t13, t12), Just t12)
  , ((t34, t12), Nothing)
  , ((t23, t13), Just t23)
  , ((t24, t13), Just t23)
  , ((t1_, t0_), Nothing)
  , ((t01, t0_), Just t01)
  , ((t13, t0_), Nothing)
  , ((t2_, t0_), Nothing)
  , ((t13, t0m), Just t13)

  , ((t13, t2m), Just t23)
  , ((t2m, t13), Just t23)
  ]
  where
    check :: ((TimeObject, TimeObject), Maybe TimeObject) -> IO ()
    check ((t1, t2), exp) =
      assertEqual "wrong intersect" exp $ timeIntersect t1 t2
    t0_ = TimeObject t0 Second Nothing
    t0m = TimeObject t0 Minute Nothing
    t01 = TimeObject t0 Second $ Just t1
    t1_ = TimeObject t1 Second Nothing
    t12 = TimeObject t1 Second $ Just t2
    t13 = TimeObject t1 Second $ Just t3
    t2_ = TimeObject t2 Second Nothing
    t2m = TimeObject t2 Minute Nothing
    t23 = TimeObject t2 Second $ Just t3
    t24 = TimeObject t2 Second $ Just t4
    t34 = TimeObject t3 Second $ Just t4
    t0 = UTCTime day 0
    t1 = UTCTime day 1
    t2 = UTCTime day 2
    t3 = UTCTime day 3
    t4 = UTCTime day 4
    day = fromGregorian 2017 2 8


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.AR.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.AR.Corpus

tests :: TestTree
tests = testGroup "AR Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

{-# LANGUAGE OverloadedStrings #-}

module Duckling.Time.BG.Tests
  ( tests
  ) where

import Data.Aeson
import Data.Aeson.Types ((.:), parseMaybe, withObject)
import Data.String
import Data.Text (Text)
import Prelude
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Asserts
import Duckling.Testing.Types hiding (examples)
import Duckling.Time.BG.Corpus
import Duckling.TimeGrain.Types (Grain(..))
import Duckling.Types (Range(..))

tests :: TestTree
tests = testGroup "BG Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.CA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.CA.Corpus

tests :: TestTree
tests = testGroup "CA Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.DA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.DA.Corpus

tests :: TestTree
tests = testGroup "DA Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.DE.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Asserts
import Duckling.Testing.Types (testContext, testOptions)
import Duckling.Time.DE.Corpus
import Duckling.Types (Range(..))

tests :: TestTree
tests = testGroup "DE Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  , rangeTests
  ]

rangeTests :: TestTree
rangeTests = testCase "Range Test" $
  mapM_ (analyzedRangeTest (testContext{locale = makeLocale DE Nothing})
         testOptions . withTargets [Seal Time]) xs
  where
    xs = [ ("Wir treffen uns am 17 Uhr am KiLa.", Range 16 25)
         ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.EL.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.EL.Corpus

tests :: TestTree
tests = testGroup "EL Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}

module Duckling.Time.EN.Tests
  ( tests
  ) where

import Data.Aeson
import Data.Aeson.Types ((.:), parseMaybe, withObject)
import Data.String
import Prelude
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Asserts
import Duckling.Testing.Types hiding (examples)
import Duckling.Time.Corpus
import Duckling.Time.EN.Corpus
import Duckling.TimeGrain.Types (Grain(..))
import Duckling.Types (Range(..))
import qualified Duckling.Region as R
import qualified Duckling.Time.EN.AU.Corpus as AU
import qualified Duckling.Time.EN.BZ.Corpus as BZ
import qualified Duckling.Time.EN.CA.Corpus as CA
import qualified Duckling.Time.EN.GB.Corpus as GB
import qualified Duckling.Time.EN.IE.Corpus as IE
import qualified Duckling.Time.EN.IN.Corpus as IN
import qualified Duckling.Time.EN.JM.Corpus as JM
import qualified Duckling.Time.EN.NZ.Corpus as NZ
import qualified Duckling.Time.EN.PH.Corpus as PH
import qualified Duckling.Time.EN.TT.Corpus as TT
import qualified Duckling.Time.EN.US.Corpus as US
import qualified Duckling.Time.EN.ZA.Corpus as ZA

tests :: TestTree
tests = testGroup "EN Tests"
  [ makeCorpusTest [Seal Time] defaultCorpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  , makeCorpusTest [Seal Time] diffCorpus
  , exactSecondTests
  , valuesTest
  , intersectTests
  , rangeTests
  , localeTests
  , makeCorpusTest [Seal Time] latentCorpus
  ]

localeTests :: TestTree
localeTests = testGroup "Locale Tests"
  [ testGroup "EN_AU Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeAU AU.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeAU []
    ]
  , testGroup "EN_BZ Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeBZ BZ.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeBZ []
    ]
  , testGroup "EN_CA Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeCA CA.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeCA []
    ]
  , testGroup "EN_GB Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeGB GB.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeGB []
    ]
  , testGroup "EN_IE Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeIE IE.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeIE []
    ]
  , testGroup "EN_IN Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeIN IN.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeIN []
    ]
  , testGroup "EN_JM Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeJM JM.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeJM []
    ]
  , testGroup "EN_NZ Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeNZ NZ.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeNZ []
    ]
  , testGroup "EN_PH Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localePH PH.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localePH []
    ]
  , testGroup "EN_TT Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeTT TT.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeTT []
    ]
  , testGroup "EN_US Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeUS US.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeUS []
    ]
  , testGroup "EN_ZA Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeZA ZA.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeZA []
    ]
  ]
  where
    localeAU = makeLocale EN $ Just AU
    localeBZ = makeLocale EN $ Just BZ
    localeCA = makeLocale EN $ Just R.CA
    localeGB = makeLocale EN $ Just GB
    localeIE = makeLocale EN $ Just IE
    localeIN = makeLocale EN $ Just IN
    localeJM = makeLocale EN $ Just JM
    localeNZ = makeLocale EN $ Just NZ
    localePH = makeLocale EN $ Just PH
    localeTT = makeLocale EN $ Just TT
    localeUS = makeLocale EN $ Just US
    localeZA = makeLocale EN $ Just ZA

exactSecondTests :: TestTree
exactSecondTests = testCase "Exact Second Tests" $
  mapM_ (analyzedFirstTest context testOptions . withTargets [Seal Time]) xs
  where
    context = testContext {referenceTime = refTime (2016, 12, 6, 13, 21, 42) 1}
    xs = concat
      [ examples (datetime (2016, 12, 6, 13, 21, 45) Second)
                 [ "in 3 seconds"
                 ]
      , examples (datetime (2016, 12, 6, 13, 31, 42) Second)
                 [ "in ten minutes"
                 ]
      , examples (datetimeInterval
          ((2016, 12, 6, 13, 21, 42), (2016, 12, 12, 0, 0, 0)) Second)
                 [ "by next week"
                 , "by Monday"
                 ]
      ]

valuesTest :: TestTree
valuesTest = testCase "Values Test" $
  mapM_ (analyzedFirstTest testContext testOptions . withTargets [Seal Time]) xs
  where
    xs = examplesCustom (parserCheck 1 parseValuesSize)
                        [ "now"
                        , "8 o'clock tonight"
                        , "yesterday"
                        ]
    parseValuesSize :: Value -> Maybe Int
    parseValuesSize x = length <$> parseValues x
    parseValues :: Value -> Maybe [Object]
    parseValues = parseMaybe $ withObject "value object" (.: "values")

intersectTests :: TestTree
intersectTests = testCase "Intersect Test" $
  mapM_ (analyzedNTest testContext testOptions . withTargets [Seal Time]) xs
  where
    xs = [ ("tomorrow July", 2)
         , ("Mar tonight", 2)
         , ("Feb tomorrow", 1) -- we are in February
         ]

rangeTests :: TestTree
rangeTests = testCase "Range Test" $
  mapM_ (analyzedRangeTest testContext testOptions . withTargets [Seal Time]) xs
  where
    xs = [ ("at 615.", Range 0 6) -- make sure ruleHHMMLatent allows this
         , ("last in 2'", Range 5 10) -- ruleLastTime too eager
         , ("this in 2'", Range 5 10) -- ruleThisTime too eager
         , ("next in 2'", Range 5 10) -- ruleNextTime too eager
         , ("this this week", Range 5 14) -- ruleThisTime too eager
         , ("one ninety nine a m", Range 11 19) -- ruleMilitarySpelledOutAMPM2
         , ("thirteen fifty nine a m", Range 15 23) -- ruleMilitarySpelledOutAMPM
         , ("table Wednesday for 30 people", Range 6 15)
           -- do not parse "for 30" as year intersect
         , ("house 1 on december 2013", Range 11 24) -- ruleAbsorbOnDay
         , ("at 6pm GMT PDT", Range 0 10) -- ruleTimezone
         , ("at 6pm (PDT) GMT", Range 0 12) -- ruleTimezoneBracket
         , ("6pm GMT - 8pm GMT PDT", Range 0 17)
           -- ruleTimezone will not match because TimeData hasTimezone.
         , ("Monday - 1", Range 0 6) -- ruleYearLatent to not accept negative years.
         ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.ES.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.ES.Corpus

tests :: TestTree
tests = testGroup "ES Tests"
  [ makeCorpusTest [Seal Time] corpus
    , makeCorpusTest [Seal Time] latentCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.FR.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.FR.Corpus

tests :: TestTree
tests = testGroup "FR Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.GA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.GA.Corpus

tests :: TestTree
tests = testGroup "GA Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.HE.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Time.HE.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HE Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.HR.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Time.HR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HR Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.HU.Tests
  ( tests ) where

import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.HU.Corpus

tests :: TestTree
tests = testGroup "HU Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.IT.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.IT.Corpus

tests :: TestTree
tests = testGroup "IT Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.JA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.JA.Corpus

tests :: TestTree
tests = testGroup "JA Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Duration] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.KA.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.KA.Corpus

tests :: TestTree
tests = testGroup "KA Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeCorpusTest [Seal Time] latentCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.KO.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.KO.Corpus

tests :: TestTree
tests = testGroup "KO Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.NB.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.NB.Corpus

tests :: TestTree
tests = testGroup "NB Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.NL.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Locale
import Duckling.Testing.Asserts
import Duckling.Testing.Types
import Duckling.Time.NL.Corpus
import qualified Duckling.Time.NL.BE.Corpus as BE

tests :: TestTree
tests = testGroup "NL Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeCorpusTest [Seal Time] latentCorpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  , localeTests
  ]

localeTests :: TestTree
localeTests = testGroup "Locale Tests"
  [ testGroup "NL_BE Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeBE BE.allExamples
    , makeNegativeCorpusTest [Seal Time] $ withLocale negativeCorpus localeBE []
    ]
  ]
  where
    localeBE = makeLocale NL $ Just BE


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.PL.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.PL.Corpus

tests :: TestTree
tests = testGroup "PL Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.PT.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.PT.Corpus

tests :: TestTree
tests = testGroup "PT Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.RO.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.RO.Corpus

tests :: TestTree
tests = testGroup "RO Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.RU.Tests
  ( tests ) where

import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.RU.Corpus

tests :: TestTree
tests = testGroup "RU Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}

module Duckling.Time.SV.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty
import Test.Tasty.HUnit
import qualified Data.HashSet as HashSet

import Duckling.Api
import Duckling.Dimensions.Types
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Asserts
import Duckling.Testing.Types hiding (examples)
import Duckling.Time.Corpus
import Duckling.Time.SV.Corpus
import Duckling.TimeGrain.Types (Grain(..))

tests :: TestTree
tests = testGroup "SV Tests"
  [ makeCorpusTest [Seal Time] corpus
  , ambiguousTests
  ]

-- Ambiguous examples occur when multiple tokens have the same value,
-- but one is more flexible (they differ in the `values` field).
-- For example, "i morgonen" can both mean "this morning" and "in the morning".
ambiguousTests :: TestTree
ambiguousTests = testCase "Ambiguous Tests" $ mapM_ check xs
  where
    xs = examples (datetimeInterval ((2013, 2, 12, 4, 0, 0), (2013, 2, 12, 12, 0, 0)) Hour)
                  [ "i morgonen"
                  ]
    ctx = testContext {locale = makeLocale SV Nothing}
    dims = HashSet.singleton $ Seal Time
    check :: Example -> IO ()
    check (input, predicate) = case analyze input ctx testOptions dims of
      [] -> assertFailure $ "empty result on " ++ show input
      xs -> mapM_ (assertBool ("predicate on " ++ show input) . predicate ctx) xs


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.TR.Tests
  ( tests ) where

import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Time.TR.Corpus

tests :: TestTree
tests = testGroup "TR Tests"
  [ makeCorpusTest [Seal Time] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.UK.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.Locale
import Duckling.Resolve
import Duckling.Testing.Asserts
import Duckling.Testing.Types (testContext, testOptions)
import Duckling.Time.UK.Corpus
import Duckling.Types (Range(..))

tests :: TestTree
tests = testGroup "UK Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.VI.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Time.VI.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "VI Tests"
  [ makeCorpusTest [Seal Time] corpus
  , makeNegativeCorpusTest [Seal Time] negativeCorpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Time.ZH.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Locale
import Duckling.Testing.Asserts
import Duckling.Testing.Types
import Duckling.Time.ZH.Corpus
import qualified Duckling.Time.ZH.CN.Corpus as CN
import qualified Duckling.Time.ZH.HK.Corpus as HK
import qualified Duckling.Time.ZH.MO.Corpus as MO
import qualified Duckling.Time.ZH.TW.Corpus as TW

tests :: TestTree
tests = testGroup "ZH Tests"
  [ makeCorpusTest [Seal Time] defaultCorpus
  , localeTests
  ]

localeTests :: TestTree
localeTests = testGroup "Locale Tests"
  [ testGroup "ZH_CN Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeCN CN.allExamples
    ]
  , testGroup "ZH_HK Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeHK HK.allExamples
    ]
  , testGroup "ZH_MO Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeMO MO.allExamples
    ]
  , testGroup "ZH_TW Tests"
    [ makeCorpusTest [Seal Time] $ withLocale corpus localeTW TW.allExamples
    ]
  ]
  where
    localeCN = makeLocale ZH $ Just CN
    localeHK = makeLocale ZH $ Just HK
    localeMO = makeLocale ZH $ Just MO
    localeTW = makeLocale ZH $ Just TW


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

{-# LANGUAGE OverloadedStrings #-}

module Duckling.Url.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty
import Test.Tasty.HUnit

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Testing.Types
import Duckling.Url.Corpus
import Duckling.Url.Types

tests :: TestTree
tests = testGroup "Url Tests"
  [ makeCorpusTest [Seal Url] corpus
  , makeNegativeCorpusTest [Seal Url] negativeCorpus
  , surroundTests
  ]

surroundTests :: TestTree
surroundTests = testCase "Surround Tests" $
  mapM_ (analyzedFirstTest testContext testOptions . withTargets [Seal Url]) xs
  where
    xs = examples (UrlData "www.lets-try-this-one.co.uk/episode-7" "lets-try-this-one.co.uk")
                  [ "phishing link: www.lets-try-this-one.co.uk/episode-7  If you want my job"
                  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import qualified Duckling.Volume.AR.Tests as AR
import qualified Duckling.Volume.CA.Tests as CA
import qualified Duckling.Volume.DE.Tests as DE
import qualified Duckling.Volume.EN.Tests as EN
import qualified Duckling.Volume.ES.Tests as ES
import qualified Duckling.Volume.FR.Tests as FR
import qualified Duckling.Volume.GA.Tests as GA
import qualified Duckling.Volume.HR.Tests as HR
import qualified Duckling.Volume.IT.Tests as IT
import qualified Duckling.Volume.KM.Tests as KM
import qualified Duckling.Volume.KO.Tests as KO
import qualified Duckling.Volume.MN.Tests as MN
import qualified Duckling.Volume.NL.Tests as NL
import qualified Duckling.Volume.PT.Tests as PT
import qualified Duckling.Volume.RO.Tests as RO
import qualified Duckling.Volume.RU.Tests as RU
import qualified Duckling.Volume.TR.Tests as TR
import qualified Duckling.Volume.ZH.Tests as ZH

tests :: TestTree
tests = testGroup "Volume Tests"
  [ AR.tests
  , CA.tests
  , DE.tests
  , EN.tests
  , ES.tests
  , FR.tests
  , GA.tests
  , HR.tests
  , IT.tests
  , KM.tests
  , KO.tests
  , MN.tests
  , NL.tests
  , PT.tests
  , RO.tests
  , RU.tests
  , TR.tests
  , ZH.tests
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.AR.Tests
  ( tests
  ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.AR.Corpus

tests :: TestTree
tests = testGroup "AR Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.CA.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Volume.CA.Corpus
import Duckling.Dimensions.Types
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "CA Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.DE.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.DE.Corpus

tests :: TestTree
tests = testGroup "DE Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.EN.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.EN.Corpus

tests :: TestTree
tests = testGroup "EN Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.ES.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.ES.Corpus

tests :: TestTree
tests = testGroup "ES Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.FR.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.FR.Corpus

tests :: TestTree
tests = testGroup "FR Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.GA.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.GA.Corpus

tests :: TestTree
tests = testGroup "GA Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.HR.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Volume.HR.Corpus
import Duckling.Testing.Asserts

tests :: TestTree
tests = testGroup "HR Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.IT.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.IT.Corpus

tests :: TestTree
tests = testGroup "IT Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.KM.Tests
  ( tests
  ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.KM.Corpus

tests :: TestTree
tests = testGroup "KM Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.KO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.KO.Corpus

tests :: TestTree
tests = testGroup "KO Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.MN.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.MN.Corpus

tests :: TestTree
tests = testGroup "MN Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.NL.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.NL.Corpus

tests :: TestTree
tests = testGroup "NL Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.PT.Tests
  ( tests ) where

import Data.String
import Prelude
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.PT.Corpus

tests :: TestTree
tests = testGroup "PT Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]


-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.

module Duckling.Volume.RO.Tests
  ( tests ) where

import Prelude
import Data.String
import Test.Tasty

import Duckling.Dimensions.Types
import Duckling.Testing.Asserts
import Duckling.Volume.RO.Corpus

tests :: TestTree
tests = testGroup "RO Tests"
  [ makeCorpusTest [Seal Volume] corpus
  ]