예제 #1
0
        public void TestFloat2DSensorExternalData()
        {
            var data   = new float[4, 3];
            var sensor = new Float2DSensor(data, "floatsensor");

            Assert.AreEqual(sensor.Height, 4);
            Assert.AreEqual(sensor.Width, 3);
        }
예제 #2
0
        public void TestFloat2DSensorWrite()
        {
            var sensor = new Float2DSensor(3, 4, "floatsensor");

            for (var h = 0; h < 4; h++)
            {
                for (var w = 0; w < 3; w++)
                {
                    sensor.floatData[h, w] = 3 * h + w;
                }
            }

            var output = new float[12];
            var writer = new WriteAdapter();

            writer.SetTarget(output, sensor.GetObservationShape(), 0);
            sensor.Write(writer);
            for (var i = 0; i < 9; i++)
            {
                Assert.AreEqual(i, output[i]);
            }
        }