package jetbrains.mps.testbench.junit.suites;
/*Generated by MPS */
import org.junit.ClassRule;
import jetbrains.mps.testbench.PerformanceMessenger;
import org.jetbrains.mps.openapi.module.SModule;
import org.junit.Test;
import java.util.List;
import jetbrains.mps.smodel.ModelAccessHelper;
import jetbrains.mps.util.Computable;
import java.util.Collection;
import org.jetbrains.mps.openapi.model.SModel;
import jetbrains.mps.checkers.TypesystemChecker;
import org.junit.Assert;
public class AuditTypeSystem extends BaseCheckModulesTest {
@ClassRule
public static final PerformanceMessenger ourStats = new PerformanceMessenger("auditTypeSystem");
public AuditTypeSystem(SModule module) {
super(module);
}
@Test
public void checkTypeSystem() {
final CheckingTestStatistic statistic = new CheckingTestStatistic();
List<String> errors = new ModelAccessHelper(BaseCheckModulesTest.getContextProject().getModelAccess()).runReadAction(new Computable<List<String>>() {
public List<String> compute() {
Collection<SModel> models = new ModelsExtractor(myModule, true).getModels();
return new CheckingTestsUtil(statistic).applyChecker(new TypesystemChecker(), models);
}
});
ourStats.report("Errors", statistic.getNumErrors());
ourStats.report("Warnings", statistic.getNumWarnings());
Assert.assertTrue("Type system errors:\n" + CheckingTestsUtil.formatErrors(errors), errors.isEmpty());
}
}