37 lines
1.2 KiB
Haskell

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# HLINT ignore "Use const" #-}
{-# HLINT ignore "Unused LANGUAGE pragma" #-}
{-# HLINT ignore "Avoid lambda" #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE NoFieldSelectors #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# LANGUAGE TypeApplications #-}
module Test.Datalog.NaiveDatabaseSpec where
import Test.Hspec
import Datalog.NaiveDatabase
import qualified Datalog.NaiveDatabase as NaiveDatabase
-- checkParse :: String -> Expr -> Expectation
-- checkParse text expectedExpr =
-- parse parseExpr "" text `shouldBe` Right expectedExpr
-- checkEval :: String -> Int -> Expectation
-- checkEval text expectedVal =
-- fmap eval (parse parseExpr "" text) `shouldBe` Right expectedVal
spec :: Spec
spec = do
describe "dummy test" $ do
it "..." $ do
1 `shouldBe` (1 :: Int)
it "can accept facts and do basic queries" $ do
let twig = [ "xx", "yy "]
let pig = [ "parent(\"alice\", \"bob\").", "parent(\"bob\", \"carol\")." ]
let db = NaiveDatabase.withFacts [ "parent(\"alice\", \"bob\").", "parent(\"bob\", \"carol\")." ]
query db"?- parent(alice,X)." `shouldBe` "#NYI" -- ideally, 'bob'