* Time Profile.pcl
*.o
*.prj
+.tags
--- /dev/null
+image: camilstaps/clean:nightly
+test:
+ before_script:
+ - apt-get update -qq
+ - apt-get install -yy build-essential wget
+ script:
+ - install_clean_nightly.sh base lib-platform
+ - bash test.bash
instance toString Scheme
-check :: [Either TypeDef Function] -> Either [String] (Expression, [([Char], Scheme)])
+check :: ![Either TypeDef Function] -> Either [String] (Expression, [([Char], Scheme)])
import StdDebug
-check :: [Either TypeDef Function] -> Either [String] (Expression, [([Char], Scheme)])
+check :: ![Either TypeDef Function] -> Either [String] (Expression, [([Char], Scheme)])
check tdfs
# dups = filter (\x->length x > 1) (groupBy (\(Function i _ _) (Function j _ _)->i == j) functions)
| length dups > 0 = Left ["Duplicate functions: ":[toString n\\[(Function n _ _):_]<-dups]]
:: Eval a
-int :: Expression -> Either [String] Value
+int :: !Expression -> Either [String] Value
:: Eval a :== StateT [([Char], Value)] (Either [String]) a
-int :: Expression -> Either [String] Value
+int :: !Expression -> Either [String] Value
int e = evalStateT (eval e)
[(['_if'], Builtin \i->pure (Lit (Builtin \t->pure (Lit (Builtin \e->
eval i >>= \(Bool b)->pure (if b t e))))))
:: Token
instance toString Token
-lex :: [Char] -> Either [String] [Token]
-parse :: [Token] -> Either [String] [Either TypeDef Function]
+lex :: ![Char] -> Either [String] [Token]
+parse :: ![Token] -> Either [String] [Either TypeDef Function]
instance toString Token where toString t = printToString t
-lex :: [Char] -> Either [String] [Token]
+lex :: ![Char] -> Either [String] [Token]
lex [] = pure []
lex ['//\n':ts] = lex ts
lex ['//',t:ts] = lex ['/','/':ts]
pChainr :: (Parser (a a -> a)) (Parser a) -> Parser a
pChainr op p = flip ($) <$> p <*> (flip <$> op <*> pChainr op p) <|> p
-parse :: [Token] -> Either [String] [Either TypeDef Function]
+parse :: ![Token] -> Either [String] [Either TypeDef Function]
parse ts = case runParser (many (Right <$> pFunction <|> Left <$> pTypeDef) <* pEof) ts [] of
(Left e, _, _) = Left e
(Right a, _, r) = sequence [reparse r a\\a<-a]
* @param list of nodes together with their their successors
* @return the strongly connected components
*/
-scc :: [(a, [a])] -> [[a]] | Eq, Ord a
+scc :: ![(a, [a])] -> [[a]] | Eq, Ord a
import StdEnv, StdMaybe
import Data.Map => qualified updateAt
-:: St a = {nextindex :: Int, stack :: [a], map :: Map a Annot, sccs :: [[a]]}
-:: Annot = {index :: Int, lowlink :: Int, onstack :: Bool}
+:: St a = {nextindex :: !Int, stack :: ![a], map :: !Map a Annot, sccs :: ![[a]]}
+:: Annot = {index :: !Int, lowlink :: !Int, onstack :: !Bool}
-scc :: [(a, [a])] -> [[a]] | Eq, Ord a
+scc :: ![(a, [a])] -> [[a]] | Eq, Ord a
scc nodes = reverse (foldr (strongconnect nodes) {nextindex=zero,stack=[],map=newMap,sccs=[]} nodes).sccs
where
- strongconnect :: [(a, [a])] (a, [a]) (St a) -> St a | Eq, Ord a
+ strongconnect :: ![(a, [a])] !(a, [a]) !(St a) -> St a | Eq, Ord a
strongconnect nodes (v, suc) s
| isJust (get v s.map) = s
# s = foldr (processSucc nodes v)
, map = foldr (alter \(Just s)->Just {s & onstack=False}) s.map scc
}
where
- processSucc :: [(a, [a])] a a (St a) -> St a | Eq, Ord a
+ processSucc :: ![(a, [a])] !a !a !(St a) -> St a | Eq, Ord a
processSucc nodes v w s = case get w s.map of
Nothing
# n = filter ((==)w o fst) nodes
--- /dev/null
+#!/bin/bash
+set -e
+shopt -s nullglob
+
+make minfp
+
+[ $# -eq 0 ] && testfiles=(tests/*.mfp) || testfiles=("${@}")
+
+pass=0
+skip=0
+fail=0
+for t in "${testfiles[@]}"; do
+ if [ ! -f "$t" ]; then
+ echo "$t doesn't exist" >&2
+ exit 1
+ fi
+
+ exp="${t/%.mfp/.expected}"
+ if [ ! -f "$exp" ]; then
+ echo "$exp doesn't exist, skipping" >&2
+ skip=$((skip+1))
+ else
+ diff <(./minfp < "$t") "$exp"
+ [ $? -ne 0 ] && fail=$((fail+1)) || pass=$((pass+1))
+ fi
+done
+echo "passed : $pass" >&2
+echo "skipped: $skip" >&2
+echo "failed : $fail" >&2