Пример #1
0
        public void AcrossTheAntipodalLine()
        {
            Encoder encoder = new Encoder(121);

            encoder.GpsLocationAdd(5, 0.0f, 0.5f, 10.0f);
            encoder.GpsLocationAdd(4, 0.0f, 0.4f, 10.0f);
            encoder.GpsLocationAdd(3, 0.0f, 0.3F, 10.0f);
            encoder.GpsLocationAdd(2, 0.0f, 0.2f, 10.0f);
            encoder.GpsLocationAdd(1, 0.0f, 0.1f, 10.0f);

            encoder.GpsLocationAdd(0, 0.0f, 0.0f, 10.0f);


            encoder.GpsLocationAdd(1, 0.0f, -0.1f, 10.0f);
            encoder.GpsLocationAdd(2, 0.0f, -0.2f, 10.0f);
            encoder.GpsLocationAdd(3, 0.0f, -0.3f, 10.0f);
            encoder.GpsLocationAdd(4, 0.0f, -0.4f, 10.0f);
            encoder.GpsLocationAdd(5, 0.0f, -0.5f, 10.0f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(242, bcdText.Length);

            Assert.AreEqual("05880000000013880003E8 0488000000000FA00003E8 0388000000000BB80003E8 02880000000007D00003E8 01880000000003E80003E8 00880000000000000003E8 0188000000FFFC180003E8 0288000000FFF8300003E8 0388000000FFF4480003E80488000000FFF0600003E80588000000FFEC780003E8".Replace(" ", ""), bcdText);
        }
        public void ChannelMaximum()
        {
            Encoder encoder = new Encoder(4);

            encoder.TemperatureAdd(64, 1.23f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual("4067000C".Replace(" ", ""), bcdText);
        }
        public void ChannelMaximum()
        {
            Encoder encoder = new Encoder(3);

            encoder.PresenceAdd(64, true);

            string bcdText = encoder.Bcd();

            Assert.AreEqual("406601", bcdText);
        }
Пример #4
0
        public void ChannelMaximum()
        {
            Encoder encoder = new Encoder(3);

            encoder.DigitalInputAdd(64, true);

            string bcdText = encoder.Bcd();

            Assert.AreEqual("400001", bcdText);
        }
Пример #5
0
        public void ChannelMaximum()
        {
            Encoder encoder = new Encoder(4);

            encoder.LuminosityAdd(64, 1234);

            string bcdText = encoder.Bcd();

            Assert.AreEqual("406504D2".Replace(" ", ""), bcdText);
        }
Пример #6
0
        public void ChannelMinimum()
        {
            Encoder encoder = new Encoder(4);

            encoder.LuminosityAdd(0, 1230);

            string bcdText = encoder.Bcd();

            Assert.AreEqual("006504CE".Replace(" ", ""), bcdText);
        }
        public void ZeroValue()
        {
            Encoder encoder = new Encoder(51);
            string  bcdText;

            encoder.TemperatureAdd(0, 0);
            bcdText = encoder.Bcd();

            Assert.AreEqual(8, bcdText.Length);
            Assert.AreEqual("00670000", bcdText);
        }
        public void OnlyOneFalse()
        {
            Encoder encoder = new Encoder(3);

            encoder.DigitalOutputAdd(0, false);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(bcdText.Length, 6);

            Assert.AreEqual("000100", bcdText);
        }
Пример #9
0
        public void OnlyOneTrue()
        {
            Encoder encoder = new Encoder(3);

            encoder.DigitalInputAdd(0, true);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(6, bcdText.Length);

            Assert.AreEqual("000001", bcdText);
        }
Пример #10
0
        public void OnlyOneZero()
        {
            Encoder encoder = new Encoder(4);

            encoder.LuminosityAdd(0, 0);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(8, bcdText.Length);

            Assert.AreEqual("00650000", bcdText);
        }
Пример #11
0
        public void MyDevicesExampleOneAccelerometer()
        {
            Encoder encoder = new Encoder(51);

            encoder.AccelerometerAdd(6, 1.234f, -1.234f, 0.0f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(16, bcdText.Length);

            Assert.AreEqual("067104D2FB2E0000", bcdText);
        }
Пример #12
0
        public void AcrossTheEquator()
        {
            Encoder encoder = new Encoder(51);

            encoder.GpsLocationAdd(1, 42.3519f, -87.9094f, 10.0f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(22, bcdText.Length);

            Assert.AreEqual("018806765FF2960A0003E8", bcdText);
        }
        public void OnlyOneZero()
        {
            Encoder encoder = new Encoder(4);

            encoder.AnalogInputAdd(0, 0.0f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(8, bcdText.Length);

            Assert.AreEqual("00020000", bcdText);
        }
Пример #14
0
        public void LatitudeNotTooPositive()
        {
            Encoder encoder = new Encoder(51);

            encoder.GpsLocationAdd(1, 90.0f, 0.00f, 10.0f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(22, bcdText.Length);

            Assert.AreEqual("0188 0DBBA0 000000 0003E8".Replace(" ", ""), bcdText);
        }
Пример #15
0
        public void OnlyOneZero()
        {
            Encoder encoder = new Encoder(3);

            encoder.RelativeHumidityAdd(0, 0.0f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(6, bcdText.Length);

            Assert.AreEqual("006800", bcdText);
        }
        public void MyDevicesExampleOneTemperature()
        {
            Encoder encoder = new Encoder(51);

            encoder.TemperatureAdd(1, -4.1f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(8, bcdText.Length);

            Assert.AreEqual("0167FFD7", bcdText);
        }
        public void OnlyOneFalse()
        {
            Encoder encoder = new Encoder(3);

            encoder.PresenceAdd(0, false);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(6, bcdText.Length);

            Assert.AreEqual("006600", bcdText);
        }
        public void TwoFalse()
        {
            Encoder encoder = new Encoder(6);

            encoder.PresenceAdd(0, false);
            encoder.PresenceAdd(1, false);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(12, bcdText.Length);

            Assert.AreEqual("006600016600", bcdText);
        }
        public void TwoTrue()
        {
            Encoder encoder = new Encoder(6);

            encoder.PresenceAdd(0, true);
            encoder.PresenceAdd(5, true);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(12, bcdText.Length);

            Assert.AreEqual("006601056601", bcdText);
        }
Пример #20
0
        public void TwoTrue()
        {
            Encoder encoder = new Encoder(6);

            encoder.DigitalInputAdd(0, true);
            encoder.DigitalInputAdd(5, true);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(12, bcdText.Length);

            Assert.AreEqual("000001050001", bcdText);
        }
Пример #21
0
        public void TwoFalse()
        {
            Encoder encoder = new Encoder(6);

            encoder.DigitalInputAdd(0, false);
            encoder.DigitalInputAdd(1, false);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(12, bcdText.Length);

            Assert.AreEqual("000000010000", bcdText);
        }
        public void MyDevicesExampleTwoTemperatures()
        {
            Encoder encoder = new Encoder(51);

            encoder.TemperatureAdd(3, 27.2f);
            encoder.TemperatureAdd(5, 25.5f);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(16, bcdText.Length);

            Assert.AreEqual("03670110056700FF", bcdText);
        }
        public void TwoTrueFalse()
        {
            Encoder encoder = new Encoder(6);

            encoder.DigitalOutputAdd(0, true);
            encoder.DigitalOutputAdd(1, false);

            string bcdText = encoder.Bcd();

            Assert.AreEqual(bcdText.Length, 12);

            Assert.AreEqual("000101010100", bcdText);
        }
        public void ZerothPositiveValuesRounding()
        {
            Encoder encoder = new Encoder(51);
            string  bcdText;

            encoder.TemperatureAdd(0, 0.10f);
            encoder.TemperatureAdd(1, 0.11f);
            encoder.TemperatureAdd(2, 0.12f);
            encoder.TemperatureAdd(3, 0.13f);
            encoder.TemperatureAdd(4, 0.14f);
            encoder.TemperatureAdd(5, 0.15f);
            encoder.TemperatureAdd(6, 0.16f);
            encoder.TemperatureAdd(7, 0.17f);
            encoder.TemperatureAdd(8, 0.18f);
            encoder.TemperatureAdd(9, 0.19f);
            bcdText = encoder.Bcd();

            Assert.AreEqual(80, bcdText.Length);
            Assert.AreEqual("00670001 01670001 02670001 03670001 04670001 05670002 06670002 07670002 08670002 09670002".Replace(" ", ""), bcdText);
        }
        public void ZerothPositiveValues()
        {
            Encoder encoder = new Encoder(51);
            string  bcdText;

            encoder.TemperatureAdd(0, 0.0f);
            encoder.TemperatureAdd(1, 0.1f);
            encoder.TemperatureAdd(2, 0.2f);
            encoder.TemperatureAdd(3, 0.3f);
            encoder.TemperatureAdd(4, 0.4f);
            encoder.TemperatureAdd(5, 0.5f);
            encoder.TemperatureAdd(6, 0.6f);
            encoder.TemperatureAdd(7, 0.7f);
            encoder.TemperatureAdd(8, 0.8f);
            encoder.TemperatureAdd(9, 0.9f);
            bcdText = encoder.Bcd();

            Assert.AreEqual(80, bcdText.Length);
            Assert.AreEqual("00670000 01670001 02670002 03670003 04670004 05670005 06670006 07670007 08670008 09670009".Replace(" ", ""), bcdText);
        }
        public void ZerothNegativeValuesRounding()
        {
            Encoder encoder = new Encoder(51);
            string  bcdText;

            encoder.TemperatureAdd(0, 0.0f);
            encoder.TemperatureAdd(1, -0.1f);
            encoder.TemperatureAdd(2, -0.12f);
            encoder.TemperatureAdd(3, -0.13f);
            encoder.TemperatureAdd(4, -0.14f);
            encoder.TemperatureAdd(5, -0.15f);
            encoder.TemperatureAdd(6, -0.16f);
            encoder.TemperatureAdd(7, -0.17f);
            encoder.TemperatureAdd(8, -0.18f);
            encoder.TemperatureAdd(9, -0.19f);
            bcdText = encoder.Bcd();

            Assert.AreEqual(80, bcdText.Length);
            Assert.AreEqual("00670000 0167FFFF 0267FFFF 0367FFFF 0467FFFF 0567FFFE 0667FFFE 0767FFFE 0867FFFE 0967FFFE".Replace(" ", ""), bcdText);
        }
        public void ZerothNegativeValues()
        {
            Encoder encoder = new Encoder(51);
            string  bcdText;

            encoder.TemperatureAdd(0, 0.0f);
            encoder.TemperatureAdd(1, -0.1f);
            encoder.TemperatureAdd(2, -0.2f);
            encoder.TemperatureAdd(3, -0.3f);
            encoder.TemperatureAdd(4, -0.4f);
            encoder.TemperatureAdd(5, -0.5f);
            encoder.TemperatureAdd(6, -0.6f);
            encoder.TemperatureAdd(7, -0.7f);
            encoder.TemperatureAdd(8, -0.8f);
            encoder.TemperatureAdd(9, -0.9f);
            bcdText = encoder.Bcd();

            Assert.AreEqual(80, bcdText.Length);
            Assert.AreEqual("00670000 0167FFFF 0267FFFE 0367FFFD 0467FFFC 0567FFFB 0667FFFA 0767FFF9 0867FFF8 0967FFF7".Replace(" ", ""), bcdText);
        }