@@ -47,6 +47,12 @@ static Function<byte>* getByteFunction(string name)
4747 if (name.compare (" ROLZ" ) == 0 )
4848 return new ROLZCodec ();
4949
50+ if (name.compare (" ROLZX" ) == 0 ) {
51+ Context ctx;
52+ ctx.putString (" transform" , " ROLZX" );
53+ return new ROLZCodec (ctx);
54+ }
55+
5056 cout << " No such byte function: " << name << endl;
5157 return nullptr ;
5258}
@@ -67,7 +73,6 @@ int testFunctionsCorrectness(const string& name)
6773 byte values[80000 ];
6874
6975 if (ii == 0 ) {
70- size = 15 ;
7176 byte arr[] = {
7277 (byte)0 , (byte)1 , (byte)2 , (byte)2 , (byte)2 , (byte)2 , (byte)7 , (byte)9 ,
7378 (byte)9 , (byte)16 , (byte)16 , (byte)16 , (byte)1 , (byte)3 , (byte)3 , (byte)3 ,
@@ -203,7 +208,7 @@ int testFunctionsCorrectness(const string& name)
203208 }
204209
205210 if (f->forward (iba1, iba2, size) == false ) {
206- if (iba1._index != size) {
211+ if (( iba1._index != size) || (iba2. _index >= iba1. _index ) ) {
207212 cout << endl
208213 << " No compression (ratio > 1.0), skip reverse" << endl;
209214 continue ;
@@ -330,7 +335,12 @@ int testFunctionsSpeed(const string& name)
330335 before = clock ();
331336
332337 if (f->forward (iba1, iba2, size) == false ) {
333- // ZRLT may fail if the input data has too few 0s
338+ if ((iba1._index != size) || (iba2._index >= iba1._index )) {
339+ cout << endl
340+ << " No compression (ratio > 1.0), skip reverse" << endl;
341+ continue ;
342+ }
343+
334344 cout << " Encoding error" << endl;
335345 delete f;
336346 continue ;
0 commit comments