1
Fork 0

start new file for the sql 2011 tests based on the grammar from the draft standard

This commit is contained in:
Jake Wheat 2014-04-20 16:13:14 +03:00
parent d69f1752a5
commit ccd0e6708f
6 changed files with 2627 additions and 2245 deletions

35
tools/Filter.lhs Normal file
View file

@ -0,0 +1,35 @@
> import System.IO
> import System.Environment
> main :: IO ()
> main = do
> [a] <- getArgs
> r <- readFile a
> let ls = lines r
> a = noAdjacentBlankLines ls
> b = concat $ combineGroups $ group [] a
> putStrLn $ unlines b
> noAdjacentBlankLines [] = []
> noAdjacentBlankLines [a] = [a]
> noAdjacentBlankLines ("":xs@("":_)) = noAdjacentBlankLines xs
> noAdjacentBlankLines (x:xs) = x:noAdjacentBlankLines xs
> group :: [String] -> [String] -> [[String]]
> group acc [] = [acc]
> group acc ("":xs) = reverse ("":acc) : group [] xs
> group acc (x:xs) = group (x : acc) xs
> combineGroups :: [[String]] -> [[String]]
> combineGroups [] = []
> combineGroups (x@(('<':_):_):xs) | gs <- map trim x
> , ns <- trim $ unwords gs
> , length ns < 80 = [ns ++ "\n"] : combineGroups xs
> combineGroups (x:xs) = x:combineGroups xs
> trim :: String -> String
> trim = x . x
> where
> x = dropWhile (==' ') . reverse

24
tools/FilterSpaces.lhs Normal file
View file

@ -0,0 +1,24 @@
> --import System.IO
> import System.Environment
> main :: IO ()
> main = do
> [a] <- getArgs
> r <- readFile a
> let ls = lines r
> putStrLn $ unlines $ map dedupeSpaces ls
> dedupeSpaces :: String -> String
> dedupeSpaces [] = []
> -- don't start until after the leading spaces
> -- including literate haskell source lines
> dedupeSpaces xs@(x:_) | x `notElem` " >" = dedupeSpaces' xs
> dedupeSpaces (x:xs) = x : dedupeSpaces xs
> dedupeSpaces' :: String -> String
> dedupeSpaces' (' ':xs@(' ':_)) = dedupeSpaces' xs
> dedupeSpaces' (x:xs) = x : dedupeSpaces' xs
> dedupeSpaces' [] = []

File diff suppressed because it is too large Load diff

View file

@ -29,6 +29,7 @@ test data to the Test.Framework tests.
> import Language.SQL.SimpleSQL.Tpch
> import Language.SQL.SimpleSQL.SQL2003
> import Language.SQL.SimpleSQL.SQL2011
Order the tests to start from the simplest first. This is also the
order on the generated documentation.
@ -45,6 +46,7 @@ order on the generated documentation.
> ,postgresTests
> ,tpchTests
> ,sql2003Tests
> ,sql2011Tests
> ]
> tests :: Test.Framework.Test