PageRenderTime 36ms CodeModel.GetById 27ms app.highlight 0ms RepoModel.GetById 0ms app.codeStats 1ms

/src-extra/tests/Database/HsSqlPpp/Tests/junk/PrecisionTests.lhs

http://github.com/JakeWheat/hssqlppp
Haskell | 42 lines | 39 code | 3 blank | 0 comment | 1 complexity | 10786b0e185883789ac479c1f76036f1 MD5 | raw file
Possible License(s): BSD-3-Clause
 1This code tests the typechecking of precision types, at the moment
 2this is limited to numeric, char and varchar.
 3
 4numeric:
 5unary closed operators: returns same precision as input
 6binary closed operators: returns highest precision of two inputs (have
 7  to combine if also have scales)
 8tricky: int8 factorial (!,!!) returns numeric, what precision?
 9few other fns whose input is not numeric, but output is
10casts to numeric: what precision?
11
12
13> module Database.HsSqlPpp.Tests.TypeChecking.PrecisionTests
14>     (precisionTests
15>     ,precisionTestData
16>     ,Item(..)) where
17>
18> import Test.HUnit
19> import Test.Framework
20> import Test.Framework.Providers.HUnit
21> --import Data.List
22> import Data.Generics.Uniplate.Data
23> import Control.Monad
24>
25> --import Database.HsSqlPpp.Utils.Here
26> import Database.HsSqlPpp.Parser
27> import Database.HsSqlPpp.TypeChecker
28> import Database.HsSqlPpp.Annotation
29> import Database.HsSqlPpp.Catalog
30> import Database.HsSqlPpp.SqlTypes
31> import Database.HsSqlPpp.Utils.PPExpr
32> --import Database.HsSqlPpp.Tests.TestUtils
33> import Database.HsSqlPpp.PrettyPrinter
34>
35> data Item = Group String [Item]
36>           | Query [CatalogUpdate] String Type
37>
38> precisionTests :: Test.Framework.Test
39> precisionTests = itemToTft precisionTestData
40>
41> precisionTestData :: Item
42> precisionTestData = Group "precision typechecking" []