module Saturn.Unstable.Extra.TupleSpec where

import qualified Saturn.Unstable.Extra.Tuple as Tuple
import qualified Test.Hspec as Hspec

spec :: Hspec.Spec
spec :: Spec
spec = [Char] -> Spec -> Spec
forall a. HasCallStack => [Char] -> SpecWith a -> SpecWith a
Hspec.describe [Char]
"Saturn.Unstable.Extra.Tuple" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
  [Char] -> Spec -> Spec
forall a. HasCallStack => [Char] -> SpecWith a -> SpecWith a
Hspec.describe [Char]
"mapBoth" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
    [Char] -> Expectation -> SpecWith (Arg Expectation)
forall a.
(HasCallStack, Example a) =>
[Char] -> a -> SpecWith (Arg a)
Hspec.it [Char]
"works" (Expectation -> SpecWith (Arg Expectation))
-> Expectation -> SpecWith (Arg Expectation)
forall a b. (a -> b) -> a -> b
$ do
      (Char -> Char) -> (Char, Char) -> (Char, Char)
forall a b. (a -> b) -> (a, a) -> (b, b)
Tuple.mapBoth Char -> Char
forall a. Enum a => a -> a
succ (Char
'A', Char
'a') (Char, Char) -> (Char, Char) -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`Hspec.shouldBe` (Char
'B', Char
'b')

  [Char] -> Spec -> Spec
forall a. HasCallStack => [Char] -> SpecWith a -> SpecWith a
Hspec.describe [Char]
"toSequence" (Spec -> Spec) -> Spec -> Spec
forall a b. (a -> b) -> a -> b
$ do
    [Char] -> Expectation -> SpecWith (Arg Expectation)
forall a.
(HasCallStack, Example a) =>
[Char] -> a -> SpecWith (Arg a)
Hspec.it [Char]
"works" (Expectation -> SpecWith (Arg Expectation))
-> Expectation -> SpecWith (Arg Expectation)
forall a b. (a -> b) -> a -> b
$ do
      (Char, Char) -> [Char]
forall a. Enum a => (a, a) -> [a]
Tuple.toSequence (Char
'b', Char
'd') [Char] -> [Char] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`Hspec.shouldBe` [Char]
"bcd"

    [Char] -> Expectation -> SpecWith (Arg Expectation)
forall a.
(HasCallStack, Example a) =>
[Char] -> a -> SpecWith (Arg a)
Hspec.it [Char]
"works with singleton" (Expectation -> SpecWith (Arg Expectation))
-> Expectation -> SpecWith (Arg Expectation)
forall a b. (a -> b) -> a -> b
$ do
      (Char, Char) -> [Char]
forall a. Enum a => (a, a) -> [a]
Tuple.toSequence (Char
'a', Char
'a') [Char] -> [Char] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`Hspec.shouldBe` [Char]
"a"

    [Char] -> Expectation -> SpecWith (Arg Expectation)
forall a.
(HasCallStack, Example a) =>
[Char] -> a -> SpecWith (Arg a)
Hspec.it [Char]
"works with empty" (Expectation -> SpecWith (Arg Expectation))
-> Expectation -> SpecWith (Arg Expectation)
forall a b. (a -> b) -> a -> b
$ do
      (Char, Char) -> [Char]
forall a. Enum a => (a, a) -> [a]
Tuple.toSequence (Char
'b', Char
'a') [Char] -> [Char] -> Expectation
forall a. (HasCallStack, Show a, Eq a) => a -> a -> Expectation
`Hspec.shouldBe` [Char]
""