public void Test03()
        {
            byte       value    = 0;
            U1SECSItem secsItem = new U1SECSItem(value);

            Assert.IsTrue(secsItem.GetValue() == 0);
        }
        public void Test04()
        {
            byte       value    = 127;
            U1SECSItem secsItem = new U1SECSItem(value);

            Assert.IsTrue(secsItem.GetValue() == 127);
        }
        public void Test23()
        {
            U1SECSItem secsItem1 = new U1SECSItem(255);
            U1SECSItem secsItem2 = new U1SECSItem(255);

            Assert.IsTrue(secsItem1.GetHashCode() == secsItem2.GetHashCode());
        }
        public void Test01()
        {
            byte       value    = 255;
            U1SECSItem secsItem = new U1SECSItem(value);

            Assert.IsTrue(secsItem.GetValue() == 255);
        }
        public void Test19()
        {
            U1SECSItem secsItem1 = new U1SECSItem(255);
            U1SECSItem secsItem2 = null;

            Assert.IsFalse(secsItem1.Equals(secsItem2));
        }
        public void Test21()
        {
            U1SECSItem secsItem1 = new U1SECSItem(255);
            Object     secsItem2 = new F8SECSItem(2.141592D);

            Assert.IsFalse(secsItem1.Equals(secsItem2));
        }
        public void Test10()
        {
            byte []    input    = { (byte)((SECSItemFormatCodeFunctions.GetNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x01), 0x01, 255 };
            U1SECSItem secsItem = new U1SECSItem(input, 0);

            Assert.IsTrue(secsItem.GetSECSItemFormatCode() == SECSItemFormatCode.U1);
        }
        public void Test17()
        {
            U1SECSItem secsItem1 = new U1SECSItem(255);
            U1SECSItem secsItem2 = new U1SECSItem(255);

            Assert.IsTrue(secsItem1.Equals(secsItem2));
        }
        public void Test09()
        {
            byte       value    = 255;
            U1SECSItem secsItem = new U1SECSItem(value);

            Assert.IsTrue(secsItem.GetSECSItemFormatCode() == SECSItemFormatCode.U1);
        }
Beispiel #10
0
        public void test02()
        {
            byte       value    = 128;
            U1SECSItem secsItem = new U1SECSItem(value);

            Assert.IsTrue(secsItem.getValue() == 128);
        }
        public void Test08()
        {
            byte []    input          = { (byte)((SECSItemFormatCodeFunctions.GetNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x01), 0x01, 127 };
            short      expectedOutput = 127;
            U1SECSItem secsItem       = new U1SECSItem(input, 0);

            Assert.IsTrue(secsItem.GetValue() == expectedOutput);
        }
        public void Test13()
        {
            byte [] expectedResult = { (byte)((SECSItemFormatCodeFunctions.GetNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x03), 0, 0, 0x01, 255 };

            U1SECSItem secsItem = new U1SECSItem(255, SECSItemNumLengthBytes.THREE);

            Assert.AreEqual(secsItem.ToRawSECSItem(), expectedResult);
        }
Beispiel #13
0
        public void test07()
        {
            byte[]     input          = { (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x01), 0x01, 0 };
            byte       expectedOutput = 0;
            U1SECSItem secsItem       = new U1SECSItem(input, 0);

            Assert.IsTrue(secsItem.getValue() == expectedOutput);
        }
Beispiel #14
0
        public void test13()
        {
            byte[] expectedResult = { (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x03), 0, 0, 0x01, 255 };

            U1SECSItem secsItem = new U1SECSItem(255, 3);

            Assert.IsTrue(secsItem.ToRawSECSItem().SequenceEqual(expectedResult));
        }
        public void Test16()
        {
            U1SECSItem secsItem = new U1SECSItem(255);

            Assert.IsTrue(secsItem.ToString().Equals("Format:U1 Value: 255"));
        }
Beispiel #16
0
        public void test01()
        {
            byte[] input =
            {
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.L) << 2) | 0x01),    25,

                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.A) << 2) | 0x01),  0x03, 0x41, 0x42, 0x43,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.B) << 2) | 0x01),  0x05,  128,  255,    0,   1, 127,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.BO) << 2) | 0x01), 0x08,    1,    0,    2,   0, 255,   0,   1,   1,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.BO) << 2) | 0x01), 0x01,    5,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.F4) << 2) | 0x01),   20,
                127,                                                                                                       127,  255,  255,
                255,                                                                                                       127,  255,  255,
                255,                                                                                                       128,    0,    0,
                127,                                                                                                       128,    0,    0,
                0,                                                                                                           0,    0,    0,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.F4) << 2) | 0x01), 0x04,  127,  127,  255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.F8) << 2) | 0x01),   40,
                127,                                                                                                      0xEF,  255,  255,  255, 255, 255, 255,
                255,                                                                                                      0XEF,  255,  255,  255, 255, 255, 255,
                255,                                                                                                      0xF0,    0,    0,    0,   0,   0,   0,
                127,                                                                                                      0XF0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   0,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.F8) << 2) | 0x01), 0x08,  127, 0xEF,  255, 255, 255, 255, 255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I1) << 2) | 0x01), 0x04,  255,  128,    0, 127,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I1) << 2) | 0x01), 0x01,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I2) << 2) | 0x01),   10,
                255,                                                                                                       255,
                128,                                                                                                         0,
                0,                                                                                                           0,
                0,                                                                                                           1,
                127,                                                                                                       255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I2) << 2) | 0x01), 0x02,  255,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I4) << 2) | 0x01),   20,
                255,                                                                                                       255,  255,  255,
                128,                                                                                                         0,    0,    0,
                0,                                                                                                           0,    0,    0,
                0,                                                                                                           0,    0,    1,
                127,                                                                                                       255,  255,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I4) << 2) | 0x01), 0x04,  255,  255,  255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I8) << 2) | 0x01),   40,
                255,                                                                                                       255,  255,  255,  255, 255, 255, 255,
                128,                                                                                                         0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   1,
                127,                                                                                                       255,  255,  255,  255, 255, 255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I8) << 2) | 0x01), 0x08,  255,  255,  255, 255, 255, 255, 255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x01), 0x04,  255,  128,    0, 127,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x01), 0x01,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U2) << 2) | 0x01),   10,
                255,                                                                                                       255,
                128,                                                                                                         0,
                0,                                                                                                           0,
                0,                                                                                                           1,
                127,                                                                                                       255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U2) << 2) | 0x01), 0x02,  255,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U4) << 2) | 0x01),   20,
                255,                                                                                                       255,  255,  255,
                128,                                                                                                         0,    0,    0,
                0,                                                                                                           0,    0,    0,
                0,                                                                                                           0,    0,    1,
                127,                                                                                                       255,  255,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U4) << 2) | 0x01), 0x04,  255,  255,  255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U8) << 2) | 0x01),   40,
                255,                                                                                                       255,  255,  255,  255, 255, 255, 255,
                128,                                                                                                         0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   1,
                127,                                                                                                       255,  255,  255,  255, 255, 255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U8) << 2) | 0x01), 0x08,  255,  255,  255, 255, 255, 255, 255, 255,

                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.L) << 2) | 0x01),    24,

                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.A) << 2) | 0x01),  0x03, 0x41, 0x42, 0x43,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.B) << 2) | 0x01),  0x05,  128,  255,    0,   1, 127,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.BO) << 2) | 0x01), 0x08,    1,    0,    2,   0, 255,   0,   1,   1,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.BO) << 2) | 0x01), 0x01,    5,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.F4) << 2) | 0x01),   20,
                127,                                                                                                       127,  255,  255,
                255,                                                                                                       127,  255,  255,
                255,                                                                                                       128,    0,    0,
                127,                                                                                                       128,    0,    0,
                0,                                                                                                           0,    0,    0,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.F4) << 2) | 0x01), 0x04,  127,  127,  255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.F8) << 2) | 0x01),   40,
                127,                                                                                                      0xEF,  255,  255,  255, 255, 255, 255,
                255,                                                                                                      0XEF,  255,  255,  255, 255, 255, 255,
                255,                                                                                                      0XF0,    0,    0,    0,   0,   0,   0,
                127,                                                                                                      0XF0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   0,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.F8) << 2) | 0x01), 0x08,  127, 0xEF,  255, 255, 255, 255, 255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I1) << 2) | 0x01), 0x04,  255,  128,    0, 127,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I1) << 2) | 0x01), 0x01,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I2) << 2) | 0x01),   10,
                255,                                                                                                       255,
                128,                                                                                                         0,
                0,                                                                                                           0,
                0,                                                                                                           1,
                127,                                                                                                       255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I2) << 2) | 0x01), 0x02,  255,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I4) << 2) | 0x01),   20,
                255,                                                                                                       255,  255,  255,
                128,                                                                                                         0,    0,    0,
                0,                                                                                                           0,    0,    0,
                0,                                                                                                           0,    0,    1,
                127,                                                                                                       255,  255,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I4) << 2) | 0x01), 0x04,  255,  255,  255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I8) << 2) | 0x01),   40,
                255,                                                                                                       255,  255,  255,  255, 255, 255, 255,
                128,                                                                                                         0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   1,
                127,                                                                                                       255,  255,  255,  255, 255, 255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.I8) << 2) | 0x01), 0x08,  255,  255,  255, 255, 255, 255, 255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x01), 0x04,  255,  128,    0, 127,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U1) << 2) | 0x01), 0x01,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U2) << 2) | 0x01),   10,
                255,                                                                                                       255,
                128,                                                                                                         0,
                0,                                                                                                           0,
                0,                                                                                                           1,
                127,                                                                                                       255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U2) << 2) | 0x01), 0x02,  255,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U4) << 2) | 0x01),   20,
                255,                                                                                                       255,  255,  255,
                128,                                                                                                         0,    0,    0,
                0,                                                                                                           0,    0,    0,
                0,                                                                                                           0,    0,    1,
                127,                                                                                                       255,  255,  255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U4) << 2) | 0x01), 0x04,  255,  255,  255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U8) << 2) | 0x01),   40,
                255,                                                                                                       255,  255,  255,  255, 255, 255, 255,
                128,                                                                                                         0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   0,
                0,                                                                                                           0,    0,    0,    0,   0,   0,   1,
                127,                                                                                                       255,  255,  255,  255, 255, 255, 255,
                (byte)((SECSItemFormatCodeFunctions.getNumberFromSECSItemFormatCode(SECSItemFormatCode.U8) << 2) | 0x01), 0x08,  255,  255,  255, 255, 255, 255, 255, 255
            };
            ListSECSItem secsItem = new ListSECSItem(input, 0);

            SECSItem testElement = null;
            LinkedList <SECSItem> expectedData1 = new LinkedList <SECSItem>();
            LinkedList <SECSItem> expectedData2 = new LinkedList <SECSItem>();

            testElement = new ASCIISECSItem("ABC");
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new BinarySECSItem(new byte[] { 128, 255, 0, 1, 127 });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new BooleanArraySECSItem(new bool[] { true, false, true, false, true, false, true, true });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new BooleanSECSItem(true);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new F4ArraySECSItem(new float[] { Single.MaxValue, Single.MinValue, Single.NegativeInfinity, Single.PositiveInfinity, 0.0F });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new F4SECSItem(Single.MaxValue);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new F8ArraySECSItem(new double[] { Double.MaxValue, Double.MinValue, Double.NegativeInfinity, Double.PositiveInfinity, 0.0D });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new F8SECSItem(Double.MaxValue);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new I1ArraySECSItem(new sbyte[] { -1, -128, 0, 127 });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new I1SECSItem((sbyte)-1);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new I2ArraySECSItem(new Int16[] { -1, -32768, 0, 1, 32767 });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new I2SECSItem(-1);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new I4ArraySECSItem(new Int32[] { -1, -2147483648, 0, 1, 2147483647 });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new I4SECSItem(-1);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new I8ArraySECSItem(new Int64[] { -1, -9223372036854775808L, 0, 1, 9223372036854775807L });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new I8SECSItem(-1);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new U1ArraySECSItem(new byte[] { 255, 128, 0, 127 });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new U1SECSItem((byte)255);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new U2ArraySECSItem(new UInt16[] { 65535, 32768, 0, 1, 32767 });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new U2SECSItem(65535);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new U4ArraySECSItem(new UInt32[] { 0xFFFFFFFF, 2147483648, 0, 1, 2147483647 });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new U4SECSItem((UInt32)0xFFFFFFFF);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new U8ArraySECSItem(new UInt64[] { 0xFFFFFFFFFFFFFFFF, 0x8000000000000000, 0x0000000000000000, 0x0000000000000001, 0x7FFFFFFFFFFFFFFF });
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);
            testElement = new U8SECSItem((UInt64)0xFFFFFFFFFFFFFFFF);
            expectedData1.AddLast(testElement);
            expectedData2.AddLast(testElement);

            ListSECSItem innerList = new ListSECSItem(expectedData2);

            expectedData1.AddLast(innerList);

            ListSECSItem expectedResult = new ListSECSItem(expectedData1);

            Console.WriteLine(secsItem.ToString());
            Console.WriteLine("\n/////////////////////////////////////////////////////////////////////////////////////////////////////\n");
            Console.WriteLine(expectedResult.ToString());

            Assert.IsTrue(secsItem.Equals(expectedResult));
        }