]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/ModuleRegressionTests.java
migrated to svn revision 33108
[simantics/platform.git] / bundles / org.simantics.scl.compiler / tests / org / simantics / scl / compiler / tests / ModuleRegressionTests.java
similarity index 51%
rename from bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/RegressionTestsWithoutPrelude.java
rename to bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/ModuleRegressionTests.java
index 4794304ca939ddd6d08568da0db1c179f1a5a32a..286d0f910868c883ecc2adfb9884ca2a51df6889 100644 (file)
@@ -1,27 +1,44 @@
 package org.simantics.scl.compiler.tests;
 
+import org.junit.AfterClass;
 import org.junit.Test;
+import org.simantics.scl.compiler.errors.Failable;
+import org.simantics.scl.compiler.module.Module;
+import org.simantics.scl.compiler.module.coverage.CoverageUtils;
+import org.simantics.scl.compiler.module.coverage.ModuleCoverage;
 import org.simantics.scl.compiler.top.ValueNotFound;
+import org.simantics.scl.runtime.profiling.BranchPoint;
 
-public class RegressionTestsWithoutPrelude extends TestBase {
-    
-    public RegressionTestsWithoutPrelude() { super("scl"); }
+public class ModuleRegressionTests extends TestBase {
+
+    public ModuleRegressionTests() { super("scl"); }
     
     @Test public void AmbiguousType() { test(); }
     @Test public void ApplicationOfNunfunction() { test(); }
     @Test public void Arity1() { test(); }
     @Test public void AsPattern() { test(); }
+    @Test public void BigContext() { test(); }
+    @Test public void BigFunction() { test(); }
+    @Test public void BinaryOperators1() { test(); }
     @Test public void BooleanId() { test(); }
+    @Test public void Bug4450() { test(); }
+    @Test public void Character1() { test(); }
     @Test public void ClashingClass() { test(); }
     @Test public void ClashingData() { test(); }
     @Test public void ClashingInstance() { test(); }
     @Test public void ClashingValueType() { test(); }
+    @Test public void Collaz() { test(); }
     @Test public void Compose() { test(); }
     @Test public void Composition() { test(); }
     @Test public void ConjunctionMacro() { test(); }
     @Test public void Constant() { test(); }
     @Test public void ConstructorNameClash() { test(); }
     @Test public void DefaultMethods1() { test(); }
+    @Test public void Deriving3() { test(); }
+    @Test public void Deriving4() { test(); }
+    @Test public void DifferentBranchTypes() { test(); }
+    @Test public void Div() { test(); }
+    @Test public void DoubleConversion() { test(); }
     @Test public void DoubleEffect() { test(); }    
     @Test public void Effects1() { test(); }
     @Test public void Effects2() { test(); }  
@@ -31,27 +48,48 @@ public class RegressionTestsWithoutPrelude extends TestBase {
     @Test public void Effects6() { test(); }
     @Test(expected=ValueNotFound.class) 
     public void EmptyModule() throws ValueNotFound {
-        test("EmptyModule", "");
+        test(new String[]{"EmptyModule"}, new String[]{""});
     }
+    @Test public void Equality() { test(); }
     @Test public void ExistentialData() { test(); }
     @Test public void ExistentialData2() { test(); }
+    @Test public void ExpressionParsing() { test(); }
     @Test public void FaultyRecursion() { test(); }
     @Test public void Fibonacci() { test(); }
+    @Test public void Fibonacci2() { test(); }
     @Test public void Fibonacci3() { test(); }
     @Test public void FingerTree() { test(); }
+    @Test public void FoldMissingInitialValue() { test(); }
+    @Test public void FoldlBuild1() { test(); }
+    @Test public void FoldlBuild2() { test(); }
     @Test public void Forall1() { test(); }
     @Test public void Forall2() { test(); }
     @Test public void Forall3() { test(); }
+    @Test public void Formula() { test(); }
+    @Test public void FromDynamic() { test(); }
+    @Test public void FromDynamic2() { test(); }
+    @Test public void FromDynamic3() { test(); }
+    @Test public void FromDynamic4() { test(); }
+    @Test public void FromDynamic5() { test(); }
+    @Test public void FunctionFunctor() { test(); }
     @Test public void Functor() { test(); }
+    @Test public void FunctorM1() { test(); }
     @Test public void Generalization() { test(); }
+    @Test public void GenericMutualRecursion() { test(); }
+    @Test public void GlobalVariables() { test(); }
     @Test public void GuardedExpressionBug() { test(); }
+    @Test public void Guards1() { test(); }
+    @Test public void Guards2() { test(); }
     @Test public void IdAsOperator() { test(); }    
     @Test public void IllegalChar() { test(); }
+    @Test public void ImportJavaConstructor() { test(); }
     @Test public void ImportRef() { test(); }
     @Test public void InconsistentArity() { test(); }
     @Test public void InconsistentIndentation() { test(); }
     @Test public void IndentationAndParenthesis() { test(); }
+    @Test public void Index() { test(); }
     @Test public void Inline1() { test(); }
+    @Test public void InstanceHierarchy() { test(); }
     @Test public void InstanceIsTypoedAsClass() { test(); }
     @Test public void InvalidClass1() { test(); }
     @Test public void InvalidEncoding() { test(); }
@@ -61,6 +99,7 @@ public class RegressionTestsWithoutPrelude extends TestBase {
     @Test public void InvalidKinds2() { test(); }
     @Test public void InvalidKinds3() { test(); }
     @Test public void InvalidLambda() { test(); }
+    @Test public void InvalidModule() { test(); }
     @Test public void InvalidPattern1() { test(); }
     @Test public void InvalidPattern2() { test(); }
     @Test public void InvalidPattern3() { test(); }
@@ -72,31 +111,55 @@ public class RegressionTestsWithoutPrelude extends TestBase {
     @Test public void JavaTypes() { test(); }
     @Test public void Kinds1() { test(); }
     @Test public void Lambda() { test(); }
+    @Test public void Layout1() { test(); }
     @Test public void List() { test(); }
     @Test public void ListError1() { test(); }
     @Test public void ListError2() { test(); }    
+    @Test public void ListSyntax() { test(); }
+    @Test public void ListSyntax10() { test(); }
+    @Test public void ListSyntax11() { test(); }
+    @Test public void ListSyntax12() { test(); }
+    @Test public void ListSyntax2() { test(); }
+    @Test public void ListSyntax3() { test(); }
+    @Test public void ListSyntax4() { test(); }
+    @Test public void ListSyntax5() { test(); }
+    @Test public void ListSyntax6() { test(); }
+    @Test public void ListSyntax7() { test(); }
+    @Test public void ListSyntax8() { test(); }
+    @Test public void ListSyntax9() { test(); }
     @Test public void ListSyntaxWithoutPrelude() { test(); }
     @Test public void LocalDefinitions() { test(); }
     @Test public void LocalDefinitions2() { test(); }
     @Test public void LocalDefinitions3() { test(); }
     @Test public void LocalDefinitions4() { test(); }
+    @Test public void LocalDefinitions5() { test(); }
     @Test public void Macros1() { test(); }
     @Test public void Macros2() { test(); }
     @Test public void Macros4() { test(); }
     @Test public void Map1() { test(); }
+    @Test public void MarketModel() { test(); }    
     @Test public void Matching() { test(); }
     @Test public void Matching2() { test(); }
-    @Test public void Matching5() { test(); }    
+    @Test public void Matching4() { test(); }
+    @Test public void Matching5() { test(); }
+    @Test public void MatchingWithMissingParameter() { test(); }
     @Test public void MatchingWithoutTypeAnnotations() { test(); }
+    @Test public void MaximumBy() { test(); }
     @Test public void Maybe1() { test(); }
     @Test public void Maybe2() { test(); }
     @Test public void Maybe3() { test(); }    
+    @Test public void Maybe4() { test(); }
+    @Test public void MissingEffect() { test(); }
     @Test public void MissingMethod() { test(); }
+    @Test public void ModuleInitialization() { test(); }
     @Test public void MonadBug1() { test(); }
+    @Test public void MonadSyntax1() { test(); }
+    @Test public void Monads1() { test(); }
     @Test public void NoDefinitionErrorMessage() { test(); }    
     @Test public void NoInstance() { test(); }
     @Test public void NoInstance2() { test(); }
     @Test public void NonassociativeOperator() { test(); }
+    @Test public void NonexistentTypeClassInAnnotation() { test(); }
     @Test public void NonexistingEffect() { test(); }
     @Test public void OneLineMatch() { test(); }    
     @Test public void OpenString1() { test(); }
@@ -104,36 +167,85 @@ public class RegressionTestsWithoutPrelude extends TestBase {
     @Test public void OverloadedArithmetic1() { test(); }
     @Test public void OverloadedArithmetic2() { test(); }
     @Test public void OverloadedArithmetic3() { test(); }
+    @Test public void OverloadedLiterals2() { test(); }
+    @Test public void Overloading1() { test(); }
+    @Test public void Parsing() { test(); }    
     @Test public void PolymorphicRecursion() { test(); }
     @Test public void PolymorphicRecursion2() { test(); }
+    @Test public void Polynomials() { test(); }
     @Test public void PrecedenceOfNonoperators() { test(); }    
     @Test public void Primes() { test(); }
+    @Test public void Proc1() { test(); }
+    @Test public void Proc2() { test(); }
+    @Test public void Proc3() { test(); }
     @Test public void Pythagoras() { test(); }
+    @Test public void Random1() { test(); }
+    @Test public void RangeSyntax() { test(); }
+    @Test public void Record1() { test(); }
+    @Test public void RecordShorthand() { test(); }
     @Test public void RecursiveContext() { test(); }
     @Test public void RecursiveValues2() { test(); }
     @Test public void RecursiveValues3() { test(); }
     @Test public void RecursiveValues4() { test(); }
+    @Test public void RedBlackTrees() { test(); }
+    @Test public void Relations1() { test(); }
+    @Test public void Relations2() { test(); }
     @Test public void RepeatedVariableInPattern() { test(); }    
+    @Test public void SSATypingBug() { test(); }
+    @Test public void Scanl() { test(); }
+    @Test public void Search() { test(); }
+    @Test public void Sections() { test(); }
+    @Test public void Select1() { test(); }
+    @Test public void Select2() { test(); }
+    @Test public void Select3() { test(); }
+    @Test public void Select4() { test(); }
+    @Test public void Select5() { test(); }
+    @Test public void Select6() { test(); }
+    @Test public void Select7() { test(); }
+    @Test public void Select8() { test(); }
+    @Test public void Select9() { test(); }
     @Test public void SelfReferringContextInTypeClass() { test(); }
+    @Test public void Serialization2() { test(); }
+    @Test public void Serialization3() { test(); }
     @Test public void SharedTypeVariable() { test(); }
     @Test public void ShortcutFusion() { test(); }
+    @Test public void Show1() { test(); }
+    @Test public void SinConst1() { test(); }
+    @Test public void Sort() { test(); }
     @Test public void Sort2() { test(); }
     @Test public void StreamFusion() { test(); }
+    @Test public void StringEscape() { test(); }
+    @Test public void StringInterpolation1() { test(); }
     @Test public void StringMatching1() { test(); }    
+    @Test public void SumOfInverses2() { test(); }
+    @Test public void TooManyParametersToSin() { test(); }
+    @Test public void Transformation1() { test(); }
+    @Test public void Transformation2() { test(); }
+    @Test public void Transformation3() { test(); }
+    @Test public void Transformation4() { test(); }
+    @Test public void Transformation5() { test(); }
+    @Test public void Transformation6() { test(); }
+    @Test public void Transformation7() { test(); }
+    @Test public void TransformationOrder() { test(); }
     @Test public void Tuples() { test(); }
     @Test public void Tuples2() { test(); }
     @Test public void TypeAlias1() { test(); }
     @Test public void TypeAlias2() { test(); }
     @Test public void TypeAlias3() { test(); }
+    @Test public void TypeAliasRefsToTypeAlias() { test(); }
     @Test public void TypeAnnotation1() { test(); }
     @Test public void TypeAnnotation2() { test(); }
     @Test public void TypeClass() { test(); }
     @Test public void TypeClassBug1() { test(); }    
+    @Test(timeout=1000L) public void TypeInferenceBug2() { test(); }
+    @Test public void TypeOf1() { test(); }
     @Test public void TypingBug1() { test(); }
     @Test public void TypingError1() { test(); }
     @Test public void TypingError2() { test(); }
+    @Test public void UnaryMinus() { test(); }
     @Test public void UndefinedValue() { test(); }
     @Test public void UnexpectedToken() { test(); }
+    @Test public void Unification1() { test(); }
     @Test public void UnknownAnnotation() { test(); }
     @Test public void UnresolvedClass() { test(); }
     @Test public void UnresolvedTypeInAnnotation() { test(); }
@@ -141,11 +253,38 @@ public class RegressionTestsWithoutPrelude extends TestBase {
     @Test public void UnresolvedVariable() { test(); }
     @Test public void UnresolvedVariable2() { test(); }   
     @Test public void ValueAsOperator() { test(); }
+    @Test public void ValueConversion() { test(); }
+    @Test public void Vector1() { test(); }
+    @Test public void Vector2() { test(); }
     @Test public void Void1() { test(); }
     @Test public void Void2() { test(); }
     @Test public void Void3() { test(); }
     @Test public void While() { test(); }
+    @Test public void While2() { test(); }
+    @Test public void While3() { test(); }    
     @Test public void WrongDefaultMethod() { test(); }
     @Test public void WrongInstanceMethod() { test(); }
-    
+
+    @AfterClass
+    public static void checkCoverage() {
+        Failable<Module> maybeModule = PRELUDE_MODULE_REPOSITORY.getModule("Prelude");
+        if(!maybeModule.didSucceed())
+            return;
+        Module module = maybeModule.getResult();
+        ModuleCoverage coverage = CoverageUtils.getCoverage(module);
+        if(coverage == null)
+            return;
+        coverage.print(System.out);
+        printCoverageTree(module.getBranchPoints().get("lookup"), 0);
+    }
+
+    private static void printCoverageTree(BranchPoint[] branchPoints, int ind) {
+        for(BranchPoint bp : branchPoints) {
+            for(int i=0;i<ind;++i)
+                System.out.print("    ");
+            System.out.println(bp.codeSize);
+            printCoverageTree(bp.children, ind+1);
+        }
+    }
+
 }