Commit 492e104d authored by Kai-Oliver Prott's avatar Kai-Oliver Prott
Browse files

Modify for base-2.0.0

parent 83fe0dfc
...@@ -5,17 +5,16 @@ ...@@ -5,17 +5,16 @@
"synopsis": "The standard preprocessor of Curry", "synopsis": "The standard preprocessor of Curry",
"category": [ "Programming", "Analysis" ], "category": [ "Programming", "Analysis" ],
"dependencies": { "dependencies": {
"base" : ">= 1.0.0, < 2.0.0", "abstract-curry": ">= 3.0.0",
"abstract-curry": ">= 2.0.0", "cass-analysis" : ">= 3.0.0",
"cass-analysis" : ">= 2.0.0", "cass" : ">= 3.0.0",
"cass" : ">= 2.0.0", "cdbi" : ">= 3.0.0",
"cdbi" : ">= 2.0.0", "currycheck" : ">= 3.0.0",
"currycheck" : ">= 2.0.0",
"fl-parser" : ">= 1.0.0", "fl-parser" : ">= 1.0.0",
"html" : ">= 2.0.0", "html" : ">= 3.0.0",
"regexp" : ">= 1.1.0", "regexp" : ">= 2.0.0",
"wl-pprint" : ">= 0.0.1", "wl-pprint" : ">= 2.0.0",
"xml" : ">= 2.0.0" "xml" : ">= 3.0.0"
}, },
"compilerCompatibility": { "compilerCompatibility": {
"pakcs": ">= 2.0.0", "pakcs": ">= 2.0.0",
......
...@@ -23,5 +23,3 @@ sort'post xs ys = length xs == length ys ...@@ -23,5 +23,3 @@ sort'post xs ys = length xs == length ys
sort7 = sort (map showInt [7,1,6,3,5,4,2]) -=- map (\d -> "+00"++show d) [1..7] sort7 = sort (map showInt [7,1,6,3,5,4,2]) -=- map (\d -> "+00"++show d) [1..7]
sortEmpty = toError (sort ([] :: [Int])) sortEmpty = toError (sort ([] :: [Int]))
...@@ -22,19 +22,20 @@ import AbstractCurry.Pretty ...@@ -22,19 +22,20 @@ import AbstractCurry.Pretty
import AbstractCurry.Build import AbstractCurry.Build
import AbstractCurry.Select import AbstractCurry.Select
import AbstractCurry.Transform import AbstractCurry.Transform
import Char
import ContractUsage import ContractUsage
import Directory import System.Directory
import System.Process
import System.Environment (getArgs)
import System.FilePath (takeDirectory)
import Distribution import Distribution
import FilePath (takeDirectory) import Data.List
import List import Data.Char
import Maybe (fromJust, isNothing) import Data.Maybe (fromJust, isNothing)
import System
-- in order to use the determinism analysis: -- in order to use the determinism analysis:
import Analysis.ProgInfo (ProgInfo, lookupProgInfo) import Analysis.ProgInfo (ProgInfo, lookupProgInfo)
import Analysis.Deterministic (Deterministic(..), nondetAnalysis) import Analysis.Deterministic (Deterministic(..), nondetAnalysis)
import CASS.Server (analyzeGeneric) import CASS.Server (analyzeGeneric)
import SimplifyPostConds import SimplifyPostConds
import TheoremUsage import TheoremUsage
...@@ -187,7 +188,7 @@ transformCProg verb opts srctxt orgprog outmodname = do ...@@ -187,7 +188,7 @@ transformCProg verb opts srctxt orgprog outmodname = do
putStrLn $ "Adding contract checking to: " ++ unwords checkfuns putStrLn $ "Adding contract checking to: " ++ unwords checkfuns
detinfo <- analyzeGeneric nondetAnalysis (progName prog) detinfo <- analyzeGeneric nondetAnalysis (progName prog)
>>= return . either id error >>= return . either id error
let newprog = transformProgram opts funposs fdecls detinfo let newprog = transformProgram opts funposs fdecls detinfo
funspecs preconds postconds prog funspecs preconds postconds prog
return (Just (renameCurryModule outmodname newprog)) return (Just (renameCurryModule outmodname newprog))
...@@ -370,11 +371,11 @@ addContract opts funposs allfdecls predecls postdecls ...@@ -370,11 +371,11 @@ addContract opts funposs allfdecls predecls postdecls
addCmtLine "Without precondition checking!" $ addCmtLine "Without precondition checking!" $
rnmFDecl rename fdecl)) rnmFDecl rename fdecl))
(find (\fd -> fromPreCondName (snd (funcName fd)) == f) predecls) (find (\fd -> fromPreCondName (snd (funcName fd)) == f) predecls)
-- Construct function with postcond. added and a function without postc.: -- Construct function with postcond. added and a function without postc.:
(postcheck,wopostfdecl) = (postcheck,wopostfdecl) =
maybe ([],woprefdecl) maybe ([],woprefdecl)
(\postdecl -> (\postdecl ->
let postname = funcName postdecl let postname = funcName postdecl
qnp = funcName woprefdecl qnp = funcName woprefdecl
rename = updateFunc id qnp rename = updateFunc id qnp
...@@ -502,10 +503,10 @@ renameProp2EasyCheck prog = ...@@ -502,10 +503,10 @@ renameProp2EasyCheck prog =
--- Name of the Test.Prop module (the clone of the EasyCheck module). --- Name of the Test.Prop module (the clone of the EasyCheck module).
propModule :: String propModule :: String
propModule = "Test.Prop" propModule = "Test.Prop"
--- Name of the EasyCheck module. --- Name of the EasyCheck module.
easyCheckModule :: String easyCheckModule :: String
easyCheckModule = "Test.EasyCheck" easyCheckModule = "Test.EasyCheck"
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -4,7 +4,7 @@ import Test.EasyCheck ...@@ -4,7 +4,7 @@ import Test.EasyCheck
-- Example: predicate to check for float strings -- Example: predicate to check for float strings
import Char(isDigit) import Data.Char (isDigit)
-- Is the argument a non-negative float string (without exponent)? -- Is the argument a non-negative float string (without exponent)?
isNNFloat :: String -> Bool isNNFloat :: String -> Bool
...@@ -15,4 +15,3 @@ main = map isNNFloat ["3.14","314"] ...@@ -15,4 +15,3 @@ main = map isNNFloat ["3.14","314"]
test1 = isNNFloat "3.14" -=- True test1 = isNNFloat "3.14" -=- True
test2 = isNNFloat "314" -=- False test2 = isNNFloat "314" -=- False
...@@ -5,7 +5,7 @@ import Test.EasyCheck ...@@ -5,7 +5,7 @@ import Test.EasyCheck
-- Example: parse World Cup soccer scores (e.g., "_:_", "3:2") -- Example: parse World Cup soccer scores (e.g., "_:_", "3:2")
import Char(isDigit) import Data.Char (isDigit)
parse (team1++" _:_ "++team2) = (team1, team2, Nothing) parse (team1++" _:_ "++team2) = (team1, team2, Nothing)
parse (team1++[' ',x,':',y,' ']++team2) parse (team1++[' ',x,':',y,' ']++team2)
......
...@@ -11,14 +11,14 @@ import AbstractCurry.Files ...@@ -11,14 +11,14 @@ import AbstractCurry.Files
import AbstractCurry.Select import AbstractCurry.Select
import AbstractCurry.Build import AbstractCurry.Build
import AbstractCurry.Pretty import AbstractCurry.Pretty
import Char(isDigit,digitToInt) import Data.Char (isDigit,digitToInt)
import DefaultRuleUsage import Data.List(isPrefixOf,isSuffixOf,partition)
import Directory import System.Directory
import System.FilePath (takeDirectory)
import System.Process
import Distribution import Distribution
import FilePath (takeDirectory)
import List(isPrefixOf,isSuffixOf,partition)
import System
import TheoremUsage import TheoremUsage
import DefaultRuleUsage
-------------------------------------------------------------------- --------------------------------------------------------------------
...@@ -320,7 +320,7 @@ transDefaultRule condfunname ar (CRule pats (CSimpleRhs exp locals)) = ...@@ -320,7 +320,7 @@ transDefaultRule condfunname ar (CRule pats (CSimpleRhs exp locals)) =
(CSymbol condfunname : args)] (CSymbol condfunname : args)]
(newpats,args) = unzip (map arg2patexp (zip [1001..] pats)) (newpats,args) = unzip (map arg2patexp (zip [1001..] pats))
arg2patexp (i,pat) = case pat of arg2patexp (i,pat) = case pat of
CPVar v -> if snd v=="_" CPVar v -> if snd v=="_"
then let newvar = (i,"patvar_"++show i) then let newvar = (i,"patvar_"++show i)
...@@ -329,7 +329,7 @@ transDefaultRule condfunname ar (CRule pats (CSimpleRhs exp locals)) = ...@@ -329,7 +329,7 @@ transDefaultRule condfunname ar (CRule pats (CSimpleRhs exp locals)) =
CPAs asv _ -> (pat, CVar asv) CPAs asv _ -> (pat, CVar asv)
_ -> let newvar = (i,"patvar_"++show i) _ -> let newvar = (i,"patvar_"++show i)
in (CPAs newvar pat, CVar newvar) in (CPAs newvar pat, CVar newvar)
------------------------------------------------------------------------ ------------------------------------------------------------------------
preUnit :: CExpr preUnit :: CExpr
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
module CIParser(parse) where module CIParser(parse) where
import List import Data.List
import Char import Data.Char
import ParseTypes import ParseTypes
......
...@@ -35,4 +35,3 @@ printFl f = ``printf "% 20.4f\n",f'' ...@@ -35,4 +35,3 @@ printFl f = ``printf "% 20.4f\n",f''
printEl :: Float -> IO () printEl :: Float -> IO ()
printEl f = do ``printf "%+20.3E",f'' >> putStr " meters\n" printEl f = do ``printf "%+20.3E",f'' >> putStr " meters\n"
putStrLn "DONE!" putStrLn "DONE!"
...@@ -39,7 +39,7 @@ testEx3 = (ex3 'a') -=- "This is a char: a" ...@@ -39,7 +39,7 @@ testEx3 = (ex3 'a') -=- "This is a char: a"
-- Integer and character formatting: -- Integer and character formatting:
testIntFixedSignedChar = ``format "%+5d%c",42,c'' -=- " +42%" testIntFixedSignedChar = ``format "%+5d%c",42,c'' -=- " +42%"
where where
c = '%' c = '%'
-- Format a string with a given width and maximal length: -- Format a string with a given width and maximal length:
ex4 :: String -> String ex4 :: String -> String
...@@ -57,7 +57,7 @@ test_intexp = (ex8 42 2143) -=- "The sum of +00042 and +2143 is +2185.\n" ...@@ -57,7 +57,7 @@ test_intexp = (ex8 42 2143) -=- "The sum of +00042 and +2143 is +2185.\n"
testFloatFixPrec3 = ``format "%+8.3f",f'' -=- " +3.142" testFloatFixPrec3 = ``format "%+8.3f",f'' -=- " +3.142"
where where
f = 3.14159 f = 3.14159
-- Format a float with an exponent: -- Format a float with an exponent:
testFloatExp = ``format "% .4E",f'' -=- " 3.1416E+02" testFloatExp = ``format "% .4E",f'' -=- " 3.1416E+02"
where where
......
import Uni import Uni
import Database.CDBI.ER import Database.CDBI.ER
import Database.CDBI.Connection import Database.CDBI.Connection
import Time import Data.Time
--- Creates the test data for Uni database. --- Creates the test data for Uni database.
main :: IO () main :: IO ()
main = runJustT $ do main = runJustT $ do
setForeignKeyCheck False setForeignKeyCheck False
insertEntries student_CDBI_Description studentList insertEntries student_CDBI_Description studentList
insertEntries lecturer_CDBI_Description lecturerList insertEntries lecturer_CDBI_Description lecturerList
insertEntries lecture_CDBI_Description lectureList insertEntries lecture_CDBI_Description lectureList
insertEntries place_CDBI_Description placeList insertEntries place_CDBI_Description placeList
insertEntries time_CDBI_Description timeList insertEntries time_CDBI_Description timeList
insertEntries exam_CDBI_Description examList insertEntries exam_CDBI_Description examList
insertEntries result_CDBI_Description resultList insertEntries result_CDBI_Description resultList
insertEntryCombined sseDescription sse1 insertEntryCombined sseDescription sse1
insertEntries participation_CDBI_Description participList insertEntries participation_CDBI_Description participList
setForeignKeyCheck True setForeignKeyCheck True
...@@ -52,7 +52,7 @@ lectureList = [lecture1, lecture2, lecture3] ...@@ -52,7 +52,7 @@ lectureList = [lecture1, lecture2, lecture3]
"This lecture provides an introduction to databases and SQL." "This lecture provides an introduction to databases and SQL."
(LecturerID 3) (LecturerID 3)
-- Places -- Places
placeList :: [Uni.Place] placeList :: [Uni.Place]
placeList = [place1, place2] placeList = [place1, place2]
where where
...@@ -76,60 +76,60 @@ examList = [exam1, exam2, exam3, exam4] ...@@ -76,60 +76,60 @@ examList = [exam1, exam2, exam3, exam4]
exam2 = Exam (ExamID 2) (Just 3.3) (LectureID 1) (TimeID 2) (PlaceID 2) exam2 = Exam (ExamID 2) (Just 3.3) (LectureID 1) (TimeID 2) (PlaceID 2)
exam3 = Exam (ExamID 3) (Just 1.7) (LectureID 2) (TimeID 3) (PlaceID 1) exam3 = Exam (ExamID 3) (Just 1.7) (LectureID 2) (TimeID 3) (PlaceID 1)
exam4 = Exam (ExamID 4) Nothing (LectureID 3) (TimeID 4) (PlaceID 2) exam4 = Exam (ExamID 4) Nothing (LectureID 3) (TimeID 4) (PlaceID 2)
-- Results -- Results
resultList :: [Uni.Result] resultList :: [Uni.Result]
resultList = resultList =
[result1, result2, result3, result4, result5, result6, result7, result8] [result1, result2, result3, result4, result5, result6, result7, result8]
where where
result1 = Result (ResultID 1) 1 (Just 5.0) (Just 30) (StudentID 1) (ExamID 1) result1 = Result (ResultID 1) 1 (Just 5.0) (Just 30) (StudentID 1) (ExamID 1)
result2 = Result (ResultID 2) 2 (Just 3.7) (Just 58) (StudentID 1) (ExamID 2) result2 = Result (ResultID 2) 2 (Just 3.7) (Just 58) (StudentID 1) (ExamID 2)
result3 = Result (ResultID 3) 1 (Just 1.0) (Just 97) (StudentID 2) (ExamID 1) result3 = Result (ResultID 3) 1 (Just 1.0) (Just 97) (StudentID 2) (ExamID 1)
result4 = Result (ResultID 4) 1 (Just 1.3) (Just 90) (StudentID 3) (ExamID 1) result4 = Result (ResultID 4) 1 (Just 1.3) (Just 90) (StudentID 3) (ExamID 1)
result5 = Result (ResultID 5) 1 (Just 1.3) (Just 91) (StudentID 1) (ExamID 3) result5 = Result (ResultID 5) 1 (Just 1.3) (Just 91) (StudentID 1) (ExamID 3)
result6 = Result (ResultID 6) 1 (Just 5.0) (Just 20) (StudentID 4) (ExamID 1) result6 = Result (ResultID 6) 1 (Just 5.0) (Just 20) (StudentID 4) (ExamID 1)
result7 = Result (ResultID 7) 2 (Just 5.0) (Just 39) (StudentID 4) (ExamID 2) result7 = Result (ResultID 7) 2 (Just 5.0) (Just 39) (StudentID 4) (ExamID 2)
result8 = Result (ResultID 8) 1 (Just 5.0) (Just 49) (StudentID 4) (ExamID 3) result8 = Result (ResultID 8) 1 (Just 5.0) (Just 49) (StudentID 4) (ExamID 3)
cd :: CombinedDescription CreateData.StudentStudentExam cd :: CombinedDescription CreateData.StudentStudentExam
cd = combineDescriptions student_CDBI_Description 0 exam_CDBI_Description 0 cd = combineDescriptions student_CDBI_Description 0 exam_CDBI_Description 0
(\st ex -> (StudentStudentExam _ st ex)) (\st ex -> (StudentStudentExam _ st ex))
(\(StudentStudentExam _ st ex) -> (st, ex)) (\(StudentStudentExam _ st ex) -> (st, ex))
data StudentStudentExam = StudentStudentExam Student Student Exam data StudentStudentExam = StudentStudentExam Student Student Exam
sseDescription :: CombinedDescription CreateData.StudentStudentExam sseDescription :: CombinedDescription CreateData.StudentStudentExam
sseDescription = sseDescription =
addDescription student_CDBI_Description 1 addDescription student_CDBI_Description 1
(\st1 (StudentStudentExam _ st2 ex) -> (StudentStudentExam st1 st2 ex)) (\st1 (StudentStudentExam _ st2 ex) -> (StudentStudentExam st1 st2 ex))
(\(StudentStudentExam st _ _) -> st) cd (\(StudentStudentExam st _ _) -> st) cd
sse1 :: StudentStudentExam sse1 :: StudentStudentExam
sse1 = sse1 =
StudentStudentExam StudentStudentExam
(Student (StudentID 5) "Mond" "Thorben" 55 "thorben@email.de" (Just 18)) (Student (StudentID 5) "Mond" "Thorben" 55 "thorben@email.de" (Just 18))
(Student (StudentID 6) "Stern" "Susanne" 77 "susanne@email.de" (Just 18)) (Student (StudentID 6) "Stern" "Susanne" 77 "susanne@email.de" (Just 18))
(Exam (ExamID 5) (Just 2.2) (LectureID 3) (TimeID 2) (PlaceID 1)) (Exam (ExamID 5) (Just 2.2) (LectureID 3) (TimeID 2) (PlaceID 1))
participList::[Participation] participList::[Participation]
participList = [particip1, particip2, particip3, particip4, particip5, participList = [particip1, particip2, particip3, particip4, particip5,
particip6, particip7, particip8, particip9] particip6, particip7, particip8, particip9]
where where
particip1 :: Participation particip1 :: Participation
particip1 = Participation (StudentID 1) (LectureID 1) particip1 = Participation (StudentID 1) (LectureID 1)
particip2 :: Participation particip2 :: Participation
particip2 = Participation (StudentID 2) (LectureID 1) particip2 = Participation (StudentID 2) (LectureID 1)
particip3 :: Participation particip3 :: Participation
particip3 = Participation (StudentID 1) (LectureID 2) particip3 = Participation (StudentID 1) (LectureID 2)
particip4 :: Participation particip4 :: Participation
particip4 = Participation (StudentID 3) (LectureID 2) particip4 = Participation (StudentID 3) (LectureID 2)
particip5 :: Participation particip5 :: Participation
particip5 = Participation (StudentID 4) (LectureID 2) particip5 = Participation (StudentID 4) (LectureID 2)
particip6 :: Participation particip6 :: Participation
particip6 = Participation (StudentID 1) (LectureID 3) particip6 = Participation (StudentID 1) (LectureID 3)
particip7:: Participation particip7:: Participation
particip7 = Participation (StudentID 2) (LectureID 3) particip7 = Participation (StudentID 2) (LectureID 3)
particip8 :: Participation particip8 :: Participation
particip8 = Participation (StudentID 5) (LectureID 3) particip8 = Participation (StudentID 5) (LectureID 3)
particip9 :: Participation particip9 :: Participation
particip9 = Participation (StudentID 6) (LectureID 3) particip9 = Participation (StudentID 6) (LectureID 3)
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
--- Checking whether the preprocessor detects errors --- Checking whether the preprocessor detects errors
import Database.CDBI.ER as C import Database.CDBI.ER as C
import Time import Data.Time
import Uni import Uni
-- "Scanner" errors -- "Scanner" errors
...@@ -15,13 +15,13 @@ testE0 =``sql Select * from Student where Age > 20 & Age < 30;'' ...@@ -15,13 +15,13 @@ testE0 =``sql Select * from Student where Age > 20 & Age < 30;''
-- Parsing errors -- Parsing errors
--missing semicolon --missing semicolon
testE1 :: IO(SQLResult [Student]) testE1 :: IO(SQLResult [Student])
testE1 =``sql Select * From Student'' testE1 =``sql Select * From Student''
-- missing table pseudony in Satisfies and missing parenthesis in first condition -- missing table pseudony in Satisfies and missing parenthesis in first condition
testE2 :: IO(SQLResult [(String, String)]) testE2 :: IO(SQLResult [(String, String)])
testE2 =``sql Select s.Firstname, s.Email testE2 =``sql Select s.Firstname, s.Email
From Student As s Inner Join Result as r On Satisfies has_a r From Student As s Inner Join Result as r On Satisfies has_a r
Where (r.Attempt = 1 And r.Grade <= 3.0 Or Where (r.Attempt = 1 And r.Grade <= 3.0 Or
(r.Attempt = 2 And r.Grade = 1.0);'' (r.Attempt = 2 And r.Grade = 1.0);''
-- missing and in between operator -- missing and in between operator
...@@ -47,13 +47,13 @@ testE6 student =``sql Insert Into Student {student};'' ...@@ -47,13 +47,13 @@ testE6 student =``sql Insert Into Student {student};''
-- too much parenthesis surrounding values -- too much parenthesis surrounding values
testE7 :: IO( SQLResult ()) testE7 :: IO( SQLResult ())
testE7 =``sql Insert Into Student Values testE7 =``sql Insert Into Student Values
((10, 2608, "Wulf", "Malte", "mwu@mail.de", 34), ((10, 2608, "Wulf", "Malte", "mwu@mail.de", 34),
(11, 4736 ,"Krause", "Johanna", "jek@mail.de", 25));'' (11, 4736 ,"Krause", "Johanna", "jek@mail.de", 25));''
-- missing into keyword -- missing into keyword
testE8 :: IO( SQLResult ()) testE8 :: IO( SQLResult ())
testE8 =``sql Insert Student Values testE8 =``sql Insert Student Values
(8, 6828, "Julia", "Krone", "julia@mail.de", 26);'' (8, 6828, "Julia", "Krone", "julia@mail.de", 26);''
-- using alias in delete query -- using alias in delete query
...@@ -62,7 +62,7 @@ testE81 studName =``sql Delete From Student s Where s.Name = {studName};'' ...@@ -62,7 +62,7 @@ testE81 studName =``sql Delete From Student s Where s.Name = {studName};''
-- missing semicolon -- missing semicolon
testE82 :: IO( SQLResult ()) testE82 :: IO( SQLResult ())
testE82 =``sql Insert Into Student Values testE82 =``sql Insert Into Student Values
(8, 6828, "Julia", "Krone", "julia@mail.de", 26)'' (8, 6828, "Julia", "Krone", "julia@mail.de", 26)''
-- SQL/consistency errors -- SQL/consistency errors
...@@ -80,8 +80,8 @@ testColumns1 = ``sql Select Student.Name, Student.Name from Student, Student;'' ...@@ -80,8 +80,8 @@ testColumns1 = ``sql Select Student.Name, Student.Name from Student, Student;''
-- Point-column has typo and is withour pseudonym and result can not be used in Satisfies -- Point-column has typo and is withour pseudonym and result can not be used in Satisfies
testE9 :: IO( SQLResult [(String, (Maybe Int))]) testE9 :: IO( SQLResult [(String, (Maybe Int))])
testE9 = ``sql Select s.Name, r.Points From Student testE9 = ``sql Select s.Name, r.Points From Student
as s, Result as r Where Point > 45 and Satisfies s has_a result;'' as s, Result as r Where Point > 45 and Satisfies s has_a result;''
-- Alias s defined twice -- Alias s defined twice
testE91 :: IO(SQLResult [(String, String)]) testE91 :: IO(SQLResult [(String, String)])
...@@ -99,51 +99,51 @@ testE93 = ``sql Select s.Name from Student where exists (Select * from Result as ...@@ -99,51 +99,51 @@ testE93 = ``sql Select s.Name from Student where exists (Select * from Result as
-- Point has a typo, undefined relation used -- Point has a typo, undefined relation used
testE94 :: IO( SQLResult [(String, (Maybe Int))]) testE94 :: IO( SQLResult [(String, (Maybe Int))])
testE94 = ``sql Select s.Name, r.Points From Student testE94 = ``sql Select s.Name, r.Points From Student
as s, Result as r Where r.Point > 45 and Satisfies s belongs_to r;'' as s, Result as r Where r.Point > 45 and Satisfies s belongs_to r;''
-- alias defined but not used for age -- alias defined but not used for age
testSE11 :: IO( SQLResult [(String, (Maybe Int))]) testSE11 :: IO( SQLResult [(String, (Maybe Int))])
testSE11 ``sql Select s.FirstName, s.Age from Student as s Where Age not null;'' testSE11 ``sql Select s.FirstName, s.Age from Student as s Where Age not null;''
-- typo in table name -- typo in table name
testE12 :: IO( SQLResult [Student]) testE12 :: IO( SQLResult [Student])
testE12 = ``sql Select * From Students;'' testE12 = ``sql Select * From Students;''
-- constraint not allowed -- constraint not allowed
testSE13 :: IO( SQLResult [(String, (Maybe Int))]) testSE13 :: IO( SQLResult [(String, (Maybe Int))])
testSE13 = ``sql Select s.Firstname, s.Age from Student as s Where s.Age = Null;'' testSE13 = ``sql Select s.Firstname, s.Age from Student as s Where s.Age = Null;''
-- this one at least results in an type error -- this one at least results in an type error
-- missing values for e-mail which con not be null -- missing values for e-mail which con not be null
testE14 :: IO( SQLResult ()) testE14 :: IO( SQLResult ())
testE15 = ``sql Insert Into Student Values testE15 = ``sql Insert Into Student Values
(8, 6828, "Julia", "Krone", 26);'' (8, 6828, "Julia", "Krone", 26);''
-- missing value for column matnum -- missing value for column matnum
testE15 :: IO( SQLResult ()) testE15 :: IO( SQLResult ())
testE15 = ``sql Insert Into Student testE15 = ``sql Insert Into Student
(Key, Name, Firstname, Email, Age) (Key, Name, Firstname, Email, Age)
Values (9,"Susan", "Krone", "susan@mail.de", 17);'' Values (9,"Susan", "Krone", "susan@mail.de", 17);''
-- non existent column given -- non existent column given
testE16 :: IO( SQLResult ()) testE16 :: IO( SQLResult ())
testE16 = ``sql Insert Into Student testE16 = ``sql Insert Into Student
(Key, MatNum, Name, Firstname, Career, Age) (Key, MatNum, Name, Firstname, Career, Age)
Values (9, 2001 ,"Susan", "Krone", "Informatik", 17);'' Values (9, 2001 ,"Susan", "Krone", "Informatik", 17);''
-- keys are referencing different tables -- keys are referencing different tables
testE9' :: IO(SQLResult [(Student, Result)]) testE9' :: IO(SQLResult [(Student, Result)])
testE9' =``sql Select Distinct * From Student As s , Result as r testE9' =``sql Select Distinct * From Student As s , Result as r
Where r.StudentTakingKey = r.Key Where r.StudentTakingKey = r.Key
Limit 5;'' Limit 5;''
-- type errors -- type errors
-- keys compared to values -- keys compared to values
testE10 :: IO(SQLResult [Student]) testE10 :: IO(SQLResult [Student])
testE10 = ``sql Select Distinct * From Student As s testE10 = ``sql Select Distinct * From Student As s
Where Exists Where Exists
( Select * From Participation As p ( Select * From Participation As p
Where s.Key = p.StudentParticipationKey And p.LectureParticipationKey Where s.Key = p.StudentParticipationKey And p.LectureParticipationKey
In (1,2,3)) Limit 5;'' In (1,2,3)) Limit 5;''
...@@ -157,41 +157,41 @@ testE17' =``sql Select Name, MatNum From Student Union Select Name From Lecturer ...@@ -157,41 +157,41 @@ testE17' =``sql Select Name, MatNum From Student Union Select Name From Lecturer
-- Points is of type Int -- Points is of type Int
testE18 :: IO( SQLResult [(String, (Maybe Int))]) testE18 :: IO( SQLResult [(String, (Maybe Int))])
testE18 = ``sql Select s.Name, r.Points From Student testE18 = ``sql Select s.Name, r.Points From Student
as s, Result as r Where r.Points > 45.5 and Satisfies s has_a r;''