Exemple #1
0
        public void SetUnboundedSequenses()
        {
            test_msgs.msg.UnboundedSequences msg = new test_msgs.msg.UnboundedSequences();
            bool[] setBoolSequence = new bool[2];
            setBoolSequence[0] = true;
            setBoolSequence[1] = false;
            msg.Bool_values    = setBoolSequence;

            bool[] getBoolSequence = msg.Bool_values;
            Assert.That(getBoolSequence.Length, Is.EqualTo(2));
            Assert.That(getBoolSequence[0], Is.True);
            Assert.That(getBoolSequence[1], Is.False);

            int[] setIntSequence = new int[2];
            setIntSequence[0] = 123;
            setIntSequence[1] = 456;
            test_msgs.msg.UnboundedSequences msg2 = new test_msgs.msg.UnboundedSequences();
            msg2.Int32_values = setIntSequence;
            int[] getIntList = msg2.Int32_values;
            Assert.That(getIntList.Length, Is.EqualTo(2));
            Assert.That(getIntList[0], Is.EqualTo(123));
            Assert.That(getIntList[1], Is.EqualTo(456));

            string[] setStringSequence = new string[2];
            setStringSequence[0] = "Hello";
            setStringSequence[1] = "world";
            test_msgs.msg.UnboundedSequences msg3 = new test_msgs.msg.UnboundedSequences();
            msg3.String_values = setStringSequence;
            string[] getStringSequence = msg3.String_values;
            Assert.That(getStringSequence.Length, Is.EqualTo(2));
            Assert.That(getStringSequence[0], Is.EqualTo("Hello"));
            Assert.That(getStringSequence[1], Is.EqualTo("world"));
        }
Exemple #2
0
        public void SetUnboundedSequences()
        {
            test_msgs.msg.UnboundedSequences msg     = new test_msgs.msg.UnboundedSequences();
            test_msgs.msg.UnboundedSequences msgCopy = new test_msgs.msg.UnboundedSequences();

            bool[] setBoolSequence = new bool[2];
            setBoolSequence[0] = true;
            setBoolSequence[1] = false;
            msg.Bool_values    = setBoolSequence;

            // msg.WriteNativeMessage();
            // msg.ReadNativeMessage();
            // Assert.That(msg.Bool_values_size, Is.EqualTo(2));
            // msgCopy.ReadNativeMessage(msg.Handle);

            // bool[] getBoolSequence = msg.Bool_values;
            // Assert.That(msg.Bool_values_size, Is.EqualTo(2));
            // Assert.That(getBoolSequence.Length, Is.EqualTo(2));
            // Assert.That(getBoolSequence[0], Is.True);
            // Assert.That(getBoolSequence[1], Is.False);

            int[] setIntSequence = new int[2];
            setIntSequence[0] = 123;
            setIntSequence[1] = 456;
            msg.Int32_values  = setIntSequence;
            int[] getIntList = msg.Int32_values;

            Assert.That(getIntList.Length, Is.EqualTo(2));
            Assert.That(getIntList[0], Is.EqualTo(123));
            Assert.That(getIntList[1], Is.EqualTo(456));

            string[] setStringSequence = new string[2];
            setStringSequence[0] = "Hello";
            setStringSequence[1] = "world";
            msg.String_values    = setStringSequence;
            string[] getStringSequence = msg.String_values;
            Assert.That(getStringSequence.Length, Is.EqualTo(2));
            Assert.That(getStringSequence[0], Is.EqualTo("Hello"));
            Assert.That(getStringSequence[1], Is.EqualTo("world"));

            Byte[] setUint8Sequence = new Byte[2];
            setUint8Sequence[0] = 1;
            setUint8Sequence[1] = 2;
            msg.Uint8_values    = setUint8Sequence;
            Byte[] getUint8Sequence = msg.Uint8_values;
            Assert.That(getUint8Sequence.Length, Is.EqualTo(2));
            Assert.That(getUint8Sequence[0], Is.EqualTo(1));
            Assert.That(getUint8Sequence[1], Is.EqualTo(2));
        }
Exemple #3
0
        public void SetMultiNested()
        {
            test_msgs.msg.MultiNested msg = new test_msgs.msg.MultiNested();

            msg.Unbounded_sequence_of_unbounded_sequences = new test_msgs.msg.UnboundedSequences[3];
            var setUnboundedSequences = new test_msgs.msg.UnboundedSequences();

            string[] string_array = new string[2];
            setUnboundedSequences.String_values    = string_array;
            setUnboundedSequences.String_values[0] = "hello";

            msg.Unbounded_sequence_of_unbounded_sequences[0] = setUnboundedSequences;
            msg.Unbounded_sequence_of_unbounded_sequences[0].String_values[1] = "world";

            Assert.That(msg.Unbounded_sequence_of_unbounded_sequences.Length, Is.EqualTo(3));

            var getUnboundedOfUnbounded = msg.Unbounded_sequence_of_unbounded_sequences;

            Assert.That(getUnboundedOfUnbounded[0].String_values[0], Is.EqualTo("hello"));
            Assert.That(getUnboundedOfUnbounded[0].String_values[1], Is.EqualTo("world"));
        }