示例#1
0
        public void TestListRemove()
        {
            CorePackage.Entity.Type.ListType  intlist = new CorePackage.Entity.Type.ListType(CorePackage.Entity.Type.Scalar.Integer);
            CorePackage.Execution.RemoveIndex ins     = new CorePackage.Execution.RemoveIndex(CorePackage.Entity.Type.Scalar.Integer);
            List <int> data = new List <int> {
                2, 0, 1
            };

            ins.SetInputValue("array", data);
            ins.SetInputValue("index", 0);

            ins.Execute();

            Assert.IsTrue(data.Count == 2);
        }
示例#2
0
        public void TestRemoveIndex()
        {
            CorePackage.Entity.Function whileTester = new CorePackage.Entity.Function();

            CorePackage.Entity.Variable idx = new CorePackage.Entity.Variable(CorePackage.Entity.Type.Scalar.Integer, 1);
            CorePackage.Entity.Variable l   = new CorePackage.Entity.Variable(new CorePackage.Entity.Type.ListType(CorePackage.Entity.Type.Scalar.Floating), new List <double> {
                1.0, 2.0, 42.0
            });

            CorePackage.Execution.RemoveIndex remove = new CorePackage.Execution.RemoveIndex
            {
                ContainerType = CorePackage.Entity.Type.Scalar.Floating
            };

            remove.GetInput("array").LinkTo(new CorePackage.Execution.Getter(l), "reference");
            remove.GetInput("index").LinkTo(new CorePackage.Execution.Getter(idx), "reference");

            whileTester.setEntryPoint(whileTester.addInstruction(remove));
            whileTester.Call();
            Assert.IsTrue(remove.GetOutputValue("removed"));
        }