Skip to main content

module examples::modfun::Test

rascal-0.40.16
typepal-0.14.8

Usage

import examples::modfun::Test;

Source code

http://github.com/usethesource/typepal/src/examples/modfun/Test.rsc

Dependencies

import examples::modfun::Syntax;
extend examples::modfun::Checker;
extend analysis::typepal::TestFramework;
import ParseTree;

function modfunSample

private ModFun modfunSample(str name) = parse(#ModFun, |project://typepal/src/examples/modfun/<name>.mfun|);

function modfunTModel

TModel modfunTModel(str name){
return modfunTModelForTree(modfunSample(name));
}

function modfunTModelForTree

TModel modfunTModelForTree(Tree pt){
return collectAndSolve(pt, modelName="modfun");
}

function modfunTModelFromStr

TModel modfunTModelFromStr(str text){
pt = parse(#start[ModFun], text).top;
return modfunTModelForTree(pt);
}

function modfunCheck

list[Message] modfunCheck(str name) {
tm = modfunTModel(name);
return tm.messages;
}

function main

value main() 
= modfunTests();

Tests

test modfunTests

test bool modfunTests()
= runTests([|project://typepal/src/examples/modfun/tests.ttl|],
#ModFun,
modfunTModelForTree,
runName = "ModFun");