@@ -7,7 +7,7 @@ import System.Exit
7import qualified Data.Set as S
7import qualified Data.Set as S
9testList :: Test
9testList :: Test
10−testList = TestList []
10+testList = TestList [testOrderBy, testLimit, testOffset]
12main :: IO ()
12main :: IO ()
@@ -29,6 +29,33 @@ testOrderBy = TestCase $ do
29 Right atom -> atom) (tuples df)
29 Right atom -> atom) (tuples df)
30 assertEqual "sort order of s" [IntegerAtom 10, IntegerAtom 20, IntegerAtom 30] vals
30 assertEqual "sort order of s" [IntegerAtom 10, IntegerAtom 20, IntegerAtom 30] vals
32−--testOffset :: Test
32+testOffset :: Test
33+testOffset = TestCase $ do
34+ (sessionId, dbconn) <- dateExamplesConnection emptyNotificationCallback
35+ Right df <- executeDataFrameExpr sessionId dbconn (
37+ convertExpr = Project (AttributeNames (S.singleton "status")) (RelationVariable "s" ()),
38+ orderExprs = [AttributeOrderExpr "status" AscendingOrder],
42+ let vals = map (\tup -> case atomForAttributeName "status" tup of
43+ Left err -> error (show err)
44+ Right atom -> atom) (tuples df)
45+ assertEqual "sort + offset" [IntegerAtom 20, IntegerAtom 30] vals
34−--testLimit :: Test
47+testLimit :: Test
48+testLimit = TestCase $ do
49+ (sessionId, dbconn) <- dateExamplesConnection emptyNotificationCallback
50+ Right df <- executeDataFrameExpr sessionId dbconn (
52+ convertExpr = Project (AttributeNames (S.singleton "status")) (RelationVariable "s" ()),
53+ orderExprs = [AttributeOrderExpr "status" DescendingOrder],
57+ let vals = map (\tup -> case atomForAttributeName "status" tup of
58+ Left err -> error (show err)
59+ Right atom -> atom) (tuples df)
60+ assertEqual "sort + limit" [IntegerAtom 30] vals