Skip to main content

module examples::fun::Test

rascal-0.40.16
typepal-0.14.8

Usage

import examples::fun::Test;

Source code

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

Dependencies

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

function funSample

private Fun funSample(str name) = parse(#Fun, |project://typepal/src/examples/fun/<name>.fun|);

function funTModel

TModel funTModel(str name){
return funTModelForTree(funSample(name));
}

function funTModelForTree

TModel funTModelForTree(Tree pt){
return collectAndSolve(pt, modelName = "fun");
}

function funTModelFromStr

TModel funTModelFromStr(str text){
pt = parse(#start[Fun], text).top;
return funTModelForTree(pt);
}

function funCheck

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

function main

value main() = funTests();

Tests

test funTests

test bool funTests() 
= runTests([|project://typepal/src/examples/fun/tests.ttl|], #Fun, funTModelForTree, runName="Fun");