Esempio n. 1
0
File: Class1.cs Progetto: hkiaipc/C3
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ex"></param>
        private void impl(string ex, string result)
        {
            //string s = "0123456789" + ex;
            string s = ex;
            byte[] bs = new byte[s.Length];

            for (int i = 0; i < s.Length; i++)
            {
                bs[i] = BitConverter.GetBytes(s[i])[0];
            }

            HZ.CRC.AsciiSum crc = new HZ.CRC.AsciiSum();
            byte[] bscrc = crc.Calc(bs, 0, s.Length);
            Assert.AreEqual((byte)result[0], bscrc[0]);
            Assert.AreEqual((byte)result[1], bscrc[1]);
            Assert.AreEqual((byte)result[2], bscrc[2]);
        }
Esempio n. 2
0
File: Class1.cs Progetto: wpmyj/c3
        /// <summary>
        ///
        /// </summary>
        /// <param name="ex"></param>
        private void impl(string ex, string result)
        {
            //string s = "0123456789" + ex;
            string s = ex;

            byte[] bs = new byte[s.Length];

            for (int i = 0; i < s.Length; i++)
            {
                bs[i] = BitConverter.GetBytes(s[i])[0];
            }

            HZ.CRC.AsciiSum crc   = new HZ.CRC.AsciiSum();
            byte[]          bscrc = crc.Calc(bs, 0, s.Length);
            Assert.AreEqual((byte)result[0], bscrc[0]);
            Assert.AreEqual((byte)result[1], bscrc[1]);
            Assert.AreEqual((byte)result[2], bscrc[2]);
        }