module Jerimum.Tests.Integration.PostgreSQL.Types.Int32ArrayTests where

import Jerimum.PostgreSQL.Types.Int32Array
import Jerimum.Tests.Integration.DataTypeHelper
import Jerimum.Tests.Integration.Resource
import Test.Tasty

tests :: TestTree
tests =
  testGroup
    "INTEGER[]"
    [ testGroup
        "data type"
        [ buildTest
            (testDataType
               "integer[]"
               ( fromInt32Array Nothing
               , fromInt32Array (Just [0, 1])
               , "{0,1}" :: String))
        , buildTest
            (testDataType
               "integer[]"
               ( fromInt32Array Nothing
               , fromInt32Array (Just [])
               , "{}" :: String))
        , buildTest
            (testDataType
               "_int4"
               ( fromInt32Array Nothing
               , fromInt32Array (Just [])
               , "{}" :: String))
        ]
    , testGroup
        "from field"
        [ buildTest
            (testDataTypeFromField
               "integer[]"
               ( fromInt32Array Nothing
               , fromInt32Array (Just [0, 1])
               , "{0,1}" :: String))
        , buildTest
            (testDataTypeFromField
               "integer[]"
               ( fromInt32Array Nothing
               , fromInt32Array (Just [])
               , "{}" :: String))
        , buildTest
            (testDataTypeFromField
               "_int4"
               ( fromInt32Array Nothing
               , fromInt32Array (Just [])
               , "{}" :: String))
        ]
    ]
