@@ -26,10 +26,11 @@ interface IExpectedErrors {
2626 [ key : string ] : string ;
2727}
2828
29- let onlyPrereleaseConfiguration = new EncodingConfiguration ( true , 0 , 0 , 2 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 , "unstable" : 0 } , 29 ) ;
30- let defaultConfiguration = new EncodingConfiguration ( false , 5 , 4 , 2 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 , "unstable" : 0 } , 9 ) ;
31- let balancedConfiguration = new EncodingConfiguration ( false , 6 , 5 , 2 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 } , 9 , "Balanced" ) ;
32- let distributedConfiguration = new EncodingConfiguration ( false , 7 , 7 , 2 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 } , 7 , "Distributed" ) ;
29+ let onlyPrereleaseConfiguration = new EncodingConfiguration ( 31 , true , 0 , 0 , 2 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 , "unstable" : 0 } , 29 ) ;
30+ let defaultConfiguration = new EncodingConfiguration ( 31 , false , 5 , 4 , 2 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 , "unstable" : 0 } , 9 ) ;
31+ let balancedConfiguration = new EncodingConfiguration ( 31 , false , 6 , 5 , 2 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 } , 9 , "Balanced" ) ;
32+ let distributedConfiguration = new EncodingConfiguration ( 31 , false , 7 , 7 , 2 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 } , 7 , "Distributed" ) ;
33+ let longDistributedConfiguration = new EncodingConfiguration ( 63 , false , 14 , 14 , 4 , { "rc" : 2 , "beta" : 1 , "alpha" : 0 } , 14 , "Long (signed 64 bits) Distributed" ) ;
3334
3435describe ( "Simple encoding" , ( ) => {
3536 let defaultConfigurationEncoder = new Encoder ( defaultConfiguration ) ;
@@ -151,7 +152,7 @@ describe("Overflows", () => {
151152 } ,
152153 } ,
153154 {
154- configuration : new EncodingConfiguration ( false , 5 , 4 , 2 , { "prod" : 4 , "preprod" : 3 , "rc" : 2 , "beta" : 1 , "alpha" : 0 } , 9 ) ,
155+ configuration : new EncodingConfiguration ( 31 , false , 5 , 4 , 2 , { "prod" : 4 , "preprod" : 3 , "rc" : 2 , "beta" : 1 , "alpha" : 0 } , 9 ) ,
155156 expectedErrors : {
156157 "0.0.0-prod.1" : "Prerelease Tag will overflow allocated bits (4 >= 4)." ,
157158 "0.0.0-preprod.1" : "The max allowed Prerelease Tag value (3) should be kept for Semver without Prerelease Tag." ,
@@ -227,6 +228,16 @@ describe("Precedence", () => {
227228 lastCode = code ;
228229 }
229230 } ) ;
231+
232+ it ( "should be preserved with configuration '" + longDistributedConfiguration . friendlyName + "'" , ( ) => {
233+ let lastCode = - 1 ;
234+ let distributedConfigurationEncoder = new Encoder ( distributedConfiguration ) ;
235+ for ( let i = 0 ; i < traits . length ; i ++ ) {
236+ let code = distributedConfigurationEncoder . encode ( traits [ i ] ) ;
237+ expect ( code ) . toBeGreaterThan ( lastCode ) ;
238+ lastCode = code ;
239+ }
240+ } ) ;
230241} ) ;
231242
232243describe ( "Disabled components encoding" , ( ) => {
0 commit comments