{-# LANGUAGE OverloadedStrings #-}
module Duckling.CreditCardNumber.Corpus
( corpus
, negativeCorpus
) where
import Prelude
import Data.String
import qualified Data.Text as T
import Duckling.CreditCardNumber.Types
import Duckling.CreditCardNumber.Helpers
import Duckling.Testing.Types
corpus :: Corpus
corpus :: Corpus
corpus = (Context
testContext, Options
testOptions, [Example]
allExamples)
negativeCorpus :: NegativeCorpus
negativeCorpus :: NegativeCorpus
negativeCorpus = (Context
testContext, Options
testOptions, [Text]
examples)
where
examples :: [Text]
examples =
[ Int -> Text -> Text
T.replicate (Int
minNumberDigits Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) Text
"0"
, Int -> Text -> Text
T.replicate (Int
maxNumberDigits Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) Text
"0"
, Text
"invalid"
, Text
"4111111111111110"
, Text
"41111111-1111-1111"
, Text
"371449635398430"
, Text
"3714496353-98431"
, Text
"6011111111111110"
, Text
"60111111-1111-1117"
, Text
"5555555555554440"
, Text
"55555555-5555-4444"
, Text
"30569309025900"
, Text
"3056930902-5904"
]
allExamples :: [Example]
allExamples :: [Example]
allExamples = [[Example]] -> [Example]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
[ CreditCardNumberValue -> [Text] -> [Example]
forall a. ToJSON a => a -> [Text] -> [Example]
examples
(Text -> Issuer -> CreditCardNumberValue
CreditCardNumberValue Text
"4111111111111111" Issuer
Visa)
[ Text
"4111111111111111"
, Text
"4111-1111-1111-1111"
]
, CreditCardNumberValue -> [Text] -> [Example]
forall a. ToJSON a => a -> [Text] -> [Example]
examples
(Text -> Issuer -> CreditCardNumberValue
CreditCardNumberValue Text
"371449635398431" Issuer
Amex)
[ Text
"371449635398431"
, Text
"3714-496353-98431"
]
, CreditCardNumberValue -> [Text] -> [Example]
forall a. ToJSON a => a -> [Text] -> [Example]
examples
(Text -> Issuer -> CreditCardNumberValue
CreditCardNumberValue Text
"6011111111111117" Issuer
Discover)
[ Text
"6011111111111117"
, Text
"6011-1111-1111-1117"
]
, CreditCardNumberValue -> [Text] -> [Example]
forall a. ToJSON a => a -> [Text] -> [Example]
examples
(Text -> Issuer -> CreditCardNumberValue
CreditCardNumberValue Text
"5555555555554444" Issuer
Mastercard)
[ Text
"5555555555554444"
, Text
"5555-5555-5555-4444"
]
, CreditCardNumberValue -> [Text] -> [Example]
forall a. ToJSON a => a -> [Text] -> [Example]
examples
(Text -> Issuer -> CreditCardNumberValue
CreditCardNumberValue Text
"30569309025904" Issuer
DinerClub)
[ Text
"30569309025904"
, Text
"3056-930902-5904"
]
, CreditCardNumberValue -> [Text] -> [Example]
forall a. ToJSON a => a -> [Text] -> [Example]
examples
(Text -> Issuer -> CreditCardNumberValue
CreditCardNumberValue Text
"3530111333300000" Issuer
Other)
[ Text
"3530111333300000" ]
]