Пример #1
0
        public void id001_Sizes()
        {
            var c = new jSignature.Tools.Base30Converter();
            var uncompresseddataobject = c.GetData(compressedtestdata);
            var stats = new jSignature.Tools.Stats(uncompresseddataobject);

            // above sig has the following limits
            // x 121 to 496
            // y 66 to 233

            Assert.AreEqual(
                new int[] {121, 66, 496, 233}
                , stats.ContentLimits
            );

            Assert.AreEqual(
                new int[] { 496 - 121 + 1, 233 - 66 + 1 }
                , stats.ContentSize
            );

            Assert.AreEqual(
                new int[] { 496, 233 }
                , stats.Size
            );
        }
        public void id001_Sizes()
        {
            var c = new jSignature.Tools.Base30Converter();
            var uncompresseddataobject = c.GetData(compressedtestdata);
            var stats = new jSignature.Tools.Stats(uncompresseddataobject);

            // above sig has the following limits
            // x 121 to 496
            // y 66 to 233

            Assert.AreEqual(
                new int[] { 121, 66, 496, 233 }
                , stats.ContentLimits
                );

            Assert.AreEqual(
                new int[] { 496 - 121 + 1, 233 - 66 + 1 }
                , stats.ContentSize
                );

            Assert.AreEqual(
                new int[] { 496, 233 }
                , stats.Size
                );
        }
        public void id002_DecompressSig()
        {
            // [[[100,50],[1,2],[3,4],[-5,-6],[5,-6]], [[50,100],[1,2],[-3,-4]]];
            // [{'x':[100,101,104,99,104],'y':[50,52,56,50,44]},{'x':[50,51,48],'y':[100,102,98]}]
            // "3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4"

            int[][][] shouldbe = new int[][][] {
                new int[][] {
                    new int[] { 100, 50 }
                    , new int[] { 1, 2 }
                    , new int[] { 3, 4 }
                    , new int[] { -5, -6 }
                    , new int[] { 5, -6 }
                }
                , new int[][] {
                    new int[] { 50, 100 }
                    , new int[] { 1, 2 }
                    , new int[] { -3, -4 }
                }
            };

            var c = new jSignature.Tools.Base30Converter();

            Assert.AreEqual(
                shouldbe
                , c.GetData("3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4")
                );
        }
        public void id002_DecompressSig()
        {
            // [[[100,50],[1,2],[3,4],[-5,-6],[5,-6]], [[50,100],[1,2],[-3,-4]]];
            // [{'x':[100,101,104,99,104],'y':[50,52,56,50,44]},{'x':[50,51,48],'y':[100,102,98]}]
            // "3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4"

            int[][][] shouldbe = new int[][][] { 
                new int[][] {
                    new int[] {100, 50}
                    ,new int[] {1, 2}
                    ,new int[] {3, 4}
                    ,new int[] {-5, -6}
                    ,new int[] {5, -6}
                }
                , new int[][] {
                    new int[] {50, 100}
                    ,new int[] {1, 2}
                    ,new int[] {-3, -4}
                }
            };

            var c = new jSignature.Tools.Base30Converter();

            Assert.AreEqual(
                shouldbe
                , c.GetData("3E13Z5Y5_1O24Z66_1O1Z3_3E2Z4")
            );
        }