public void TestInterpolation()
 {
     {
         var one = new OuterComponent {
             @float = new FloatProperty(1.0f), vector = new VectorProperty(Vector3.one)
         };
         var two = new OuterComponent {
             @float = new FloatProperty(2.0f), vector = new VectorProperty(Vector3.zero)
         };
         var interpolated = new OuterComponent();
         Interpolator.InterpolateInto(one, two, interpolated, 0.5f);
         Assert.AreEqual(1.5f, [email protected], 1e-6f);
         Assert.AreEqual(new Vector3(0.5f, 0.5f, 0.5f), interpolated.vector.Value);
     }
     {
         var one = new CyclicComponent {
             @float = new FloatProperty(0.9f)
         };
         var two = new CyclicComponent {
             @float = new FloatProperty(0.3f)
         };
         var interpolated = new CyclicComponent();
         Interpolator.InterpolateInto(one, two, interpolated, 0.5f);
         Assert.AreEqual(0.1f, [email protected], 1e-6f);
     }
 }
Example #2
0
        public void TestCopier()
        {
            OuterComponent source      = OuterComponent.Arbitrary;
            var            destination = new OuterComponent();

            destination.CopyFrom(source);
            Assert.IsTrue(destination.EqualTo(source));
        }
Example #3
0
        public void TestMerge()
        {
            var source = new OuterComponent {
                @float = new FloatProperty(1.0f)
            };
            var merged = new OuterComponent {
                @float = new FloatProperty(2.0f), @uint = new UIntProperty(3)
            };

            merged.MergeFrom(source);
            Assert.AreEqual(1.0f, [email protected], 1e-6f);
            Assert.AreEqual(3, [email protected]);
        }
        public void TestSerializer()
        {
            OuterComponent arbitrary = OuterComponent.Arbitrary;
            var            stream    = new MemoryStream();

            arbitrary.Serialize(stream);

            var deserialized = new OuterComponent();

            stream.Position = 0;
            deserialized.Deserialize(stream);

            Assert.IsTrue(arbitrary.EqualTo(deserialized));
            Assert.AreNotSame(arbitrary.inner, deserialized.inner);
        }
Example #5
0
        public void TestEquals()
        {
            OuterComponent c1 = OuterComponent.Arbitrary, c2 = OuterComponent.Arbitrary;

            Assert.IsTrue(c1.EqualTo(c2));
        }
Example #6
0
        public void TestClone()
        {
            OuterComponent component = OuterComponent.Arbitrary;

            Assert.IsTrue(component.EqualTo(component.Clone()));
        }