Skip to main content

module lang::cpp::tests::AST

rascal-0.34.0
clair-0.12.0

Usage

import lang::cpp::tests::AST;

Source code

http://github.com/usethesource/clair/blob/main/src/lang/cpp/tests/AST.rsc

Dependencies

extend lang::cpp::AST;
import analysis::m3::AST;
import List;
import util::Monitor;
import IO;

function testFiles

list[loc] testFiles()

function astContract

bool astContract()

Tests

test declTypeFeature

test bool declTypeFeature() {
t = parseCpp(|project://clair/src/test/declTypes.cpp|);

/* we expect at two qualified names with a computed type expression in it: */
computedNames = [q | /q:qualifiedName([decltypeName(Expression _), *_], _) := t];

/* and we expect three declarations where the type of the declared variable is computed */
computedTypes = [q | /q:declSpecifier(_, decltype(Expression _)) := t];

return size(computedNames) == 2 && size(computedTypes) == 3;
}