34 lines
1.0 KiB
Haskell
34 lines
1.0 KiB
Haskell
|
|
{-# LANGUAGE DuplicateRecordFields #-}
|
||
|
|
{-# LANGUAGE OverloadedRecordDot #-}
|
||
|
|
{-# HLINT ignore "Use const" #-}
|
||
|
|
{-# HLINT ignore "Unused LANGUAGE pragma" #-}
|
||
|
|
{-# HLINT ignore "Avoid lambda" #-}
|
||
|
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||
|
|
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
|
||
|
|
{-# LANGUAGE TypeApplications #-}
|
||
|
|
|
||
|
|
module Test.Datalog.DigestedQuerySpec where
|
||
|
|
|
||
|
|
import Test.Hspec
|
||
|
|
import Datalog.DatalogParser
|
||
|
|
import Datalog.DigestedQuery (DigestedQuery(..), DigestedQueryCondition(..), DigestedQueryEntry(..))
|
||
|
|
import Datalog.DigestedQuery (digestQuery)
|
||
|
|
|
||
|
|
spec :: Spec
|
||
|
|
spec = do
|
||
|
|
describe "DigestedQuery" $ do
|
||
|
|
it "can digest basic queries" $ do
|
||
|
|
digestQuery "?- parent(alice,X)." `shouldBe` DigestedQuery {
|
||
|
|
allBoundVariables = ["X"],
|
||
|
|
numSoughtVariables = 1,
|
||
|
|
conditions = [
|
||
|
|
DigestedQueryCondition {
|
||
|
|
__relation = "parent",
|
||
|
|
_entries = [
|
||
|
|
DigestedQueryEntryConstant $ Sym "alice",
|
||
|
|
DigestedQueryEntryVariable 0
|
||
|
|
]
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|