@@ -130,6 +130,9 @@ class SigmaDslTesting extends AnyPropSpec
130
130
/** Version in which the feature is first implemented of changed. */
131
131
def sinceVersion : Byte
132
132
133
+ /** 0 = script version based activation, 1 = tree version based activation */
134
+ def activationType : Byte
135
+
133
136
/** Script containing this feature. */
134
137
def script : String
135
138
@@ -407,8 +410,8 @@ class SigmaDslTesting extends AnyPropSpec
407
410
}
408
411
409
412
val (expectedResult, expectedCost) = if (
410
- (activatedVersionInTests < VersionContext . V6SoftForkVersion && activatedVersionInTests < sinceVersion) ||
411
- (activatedVersionInTests < sinceVersion && ergoTreeVersionInTests < sinceVersion)
413
+ (activationType == 0 && activatedVersionInTests < sinceVersion) ||
414
+ (activationType == 1 && ergoTreeVersionInTests < sinceVersion)
412
415
) {
413
416
(expected.oldResult, expected.verificationCostOpt)
414
417
} else {
@@ -519,6 +522,8 @@ class SigmaDslTesting extends AnyPropSpec
519
522
520
523
override def sinceVersion : Byte = 0
521
524
525
+ override val activationType = 0
526
+
522
527
override def isSupportedIn (vc : VersionContext ): Boolean = true
523
528
524
529
/** in v5.x the old and the new interpreters are the same */
@@ -687,6 +692,7 @@ class SigmaDslTesting extends AnyPropSpec
687
692
printExpectedExpr : Boolean = true ,
688
693
logScript : Boolean = LogScriptDefault ,
689
694
allowNewToSucceed : Boolean = false ,
695
+ override val activationType : Byte = 1 ,
690
696
override val allowDifferentErrors : Boolean = false
691
697
)(implicit IR : IRContext , override val evalSettings : EvalSettings , val tA : RType [A ], val tB : RType [B ])
692
698
extends Feature [A , B ] { feature =>
@@ -777,10 +783,16 @@ class SigmaDslTesting extends AnyPropSpec
777
783
override def checkExpected (input : A , expected : Expected [B ]): Unit = {
778
784
// check the new implementation with Scala semantic function
779
785
val newRes = VersionContext .withVersions(activatedVersionInTests, ergoTreeVersionInTests) {
780
- checkEq(scalaFuncNew)(newF)(input)
786
+ checkEq(scalaFuncNew)(newF)(input)
787
+ }
788
+
789
+ val checkOld = if (changedInVersion < V6SoftForkVersion ) {
790
+ VersionContext .current.activatedVersion < changedInVersion
791
+ } else {
792
+ VersionContext .current.ergoTreeVersion < changedInVersion
781
793
}
782
794
783
- if (VersionContext .current.activatedVersion < changedInVersion && VersionContext .current.ergoTreeVersion < changedInVersion ) {
795
+ if (checkOld ) {
784
796
// check the old implementation with Scala semantic
785
797
val expectedOldRes = expected.value
786
798
@@ -880,6 +892,7 @@ class SigmaDslTesting extends AnyPropSpec
880
892
override val scalaFuncNew : A => B ,
881
893
expectedExpr : Option [SValue ],
882
894
printExpectedExpr : Boolean = true ,
895
+ override val activationType : Byte = 1 ,
883
896
logScript : Boolean = LogScriptDefault
884
897
)(implicit IR : IRContext , override val evalSettings : EvalSettings , val tA : RType [A ], val tB : RType [B ])
885
898
extends Feature [A , B ] {
@@ -1155,12 +1168,15 @@ class SigmaDslTesting extends AnyPropSpec
1155
1168
script : String ,
1156
1169
expectedExpr : SValue = null ,
1157
1170
allowNewToSucceed : Boolean = false ,
1158
- allowDifferentErrors : Boolean = false
1171
+ allowDifferentErrors : Boolean = false ,
1172
+ activationType : Byte = 1
1159
1173
)
1160
1174
(implicit IR : IRContext , evalSettings : EvalSettings ): Feature [A , B ] = {
1161
1175
ChangedFeature (changedInVersion, script, scalaFunc, scalaFuncNew, Option (expectedExpr),
1162
1176
allowNewToSucceed = allowNewToSucceed,
1163
- allowDifferentErrors = allowDifferentErrors)
1177
+ allowDifferentErrors = allowDifferentErrors,
1178
+ activationType = activationType
1179
+ )
1164
1180
}
1165
1181
1166
1182
/** Describes a NEW language feature which must NOT be supported in v4 and
0 commit comments