Example #1
0
        public void Convert12bitTo10TestNegValues()
        {
            Block testBlock = new Block();

            int val1 = testBlock.Convert12bitToAdcVal(4092);
            int val2 = testBlock.Convert12bitToAdcVal(4094);

            Assert.AreEqual(-511, val1);
            Assert.AreEqual(-511, val2);
        }
Example #2
0
        public void Convert12bitTo10Test()
        {
            Block testBlock = new Block();

            int val1 = testBlock.Convert12bitToAdcVal(4000);
            int val2 = testBlock.Convert12bitToAdcVal(2976);
            int val3 = testBlock.Convert12bitToAdcVal(3488);
            int val4 = testBlock.Convert12bitToAdcVal(3872);

            Assert.AreEqual(-488, val1);
            Assert.AreEqual(-232, val2);
            Assert.AreEqual(-360, val3);

            Assert.AreEqual(-456, val4);
        }
Example #3
0
        public void ParseTestEasy()
        {
            byte[] buf1 = new byte[30];

            buf1[0]=0xAA;
            buf1[1]=0xA1;
            buf1[2] = 0xF5;
            buf1[3] = 0x01;
            buf1[4] = 0x55;
            buf1[24] = 0x24;
            buf1[25] = 0x1A;
            Block testBlock = new Block( buf1.ToList(), 0);
            List<int> result = testBlock.Parse();

            Assert.AreEqual(17, result.Count);
            Assert.AreEqual(testBlock.Convert12bitToAdcVal(0xAAA), result[0]);
            Assert.AreEqual(testBlock.Convert12bitToAdcVal(0x1f5), result[1]);
            Assert.AreEqual(testBlock.Convert12bitToAdcVal(0x015), result[2]);
            Assert.AreEqual(testBlock.Convert12bitToAdcVal(0x241), result[16]);
        }