public void GenerateObjectVertex() { CoreCommand.BinaryManager manager = new CoreCommand.BinaryManager(); uint vector3Df = GenerateObjectInto(manager, "Vector3Df", new Dictionary <string, uint> { { "x", (uint)BASE_ID.FLOATING_TYPE }, { "y", (uint)BASE_ID.FLOATING_TYPE }, { "z", (uint)BASE_ID.FLOATING_TYPE } }); uint vector2Di = GenerateObjectInto(manager, "Vector2Di", new Dictionary <string, uint> { { "x", (uint)BASE_ID.INTEGER_TYPE }, { "y", (uint)BASE_ID.INTEGER_TYPE } }); uint color = GenerateObjectInto(manager, "Color", new Dictionary <string, uint> { { "r", (uint)BASE_ID.INTEGER_TYPE }, { "g", (uint)BASE_ID.INTEGER_TYPE }, { "b", (uint)BASE_ID.INTEGER_TYPE }, { "a", (uint)BASE_ID.INTEGER_TYPE } }); GenerateObjectInto(manager, "Vertex", new Dictionary <string, uint> { { "position", vector3Df }, { "normal", vector3Df }, { "texturecoord", vector2Di }, { "color", color } }); manager.SaveCommandsTo("vertex.dnai"); }
public void GenerateObjectVector() { CoreCommand.BinaryManager manager = new CoreCommand.BinaryManager(); GenerateObjectInto(manager, "Vector", new Dictionary <string, uint> { { "x", (uint)BASE_ID.INTEGER_TYPE }, { "y", (uint)BASE_ID.INTEGER_TYPE }, { "z", (uint)BASE_ID.INTEGER_TYPE } }); manager.SaveCommandsTo("vector.dnai"); }
//[TestMethod] public void ManagerCoverage() { CoreCommand.IManager dispatcher = new CoreCommand.BinaryManager(); testCommand( dispatcher, new CoreCommand.Command.Global.CreateProject { ProjectName = "Testor" }, "GLOBAL.CREATE_PROJECT", (CoreCommand.Command.Global.CreateProject command, CoreCommand.Command.Global.CreateProject.Reply reply) => { Assert.IsTrue(reply.RootId == 6); } ); testCommand( dispatcher, new CoreCommand.Command.Declarator.Declare { ContainerID = 6, EntityType = CoreControl.EntityFactory.ENTITY.VARIABLE, Name = "toto", Visibility = CoreControl.EntityFactory.VISIBILITY.PUBLIC }, "DECLARATOR.DECLARE", (CoreCommand.Command.Declarator.Declare command, CoreCommand.Command.Declarator.Declare.Reply reply) => { Assert.IsTrue(reply.EntityID == 7); }); testCommand( dispatcher, new CoreCommand.Command.Variable.SetType { VariableID = 7, TypeID = 2 }, "VARIABLE.SET_TYPE", (CoreCommand.Command.Variable.SetType message, CoreCommand.EmptyReply reply) => { }); testCommand( dispatcher, new CoreCommand.Command.Variable.SetValue { VariableID = 7, Value = "42" }, "VARIABLE.SET_VALUE", (CoreCommand.Command.Variable.SetValue message, CoreCommand.EmptyReply reply) => { }); testCommand( dispatcher, new CoreCommand.Command.Declarator.SetVisibility { ContainerID = 6, Name = "toto", NewVisi = CoreControl.EntityFactory.VISIBILITY.PUBLIC }, "DECLARATOR.SET_VISIBILITY", (CoreCommand.Command.Declarator.SetVisibility message, CoreCommand.EmptyReply reply) => { }); testCommand( dispatcher, new CoreCommand.Command.Variable.GetValue { VariableId = 7 }, "VARIABLE.GET_VALUE", (CoreCommand.Command.Variable.GetValue message, CoreCommand.Command.Variable.GetValue.Reply reply) => { Assert.IsTrue(reply.Value == "42"); }); //testCommand( // dispatcher, // new CoreCommand.Command.Move // { // EntityType = CoreControl.EntityFactory.ENTITY.VARIABLE, // Name = "toto", // FromID = 6, // ToID = 6 // }, // dispatcher.OnMove, // (CoreCommand.Command.Move message, CoreCommand.Reply.Move reply) => // { // Assert.IsTrue( // message.Name == reply.Command.Name // && message.FromID == reply.Command.FromID // && message.EntityType == reply.Command.EntityType // && message.ToID == reply.Command.ToID // ); // }); testCommand( dispatcher, new CoreCommand.Command.Declarator.Remove { ContainerID = 6, Name = "toto" }, "DECLARATOR.REMOVE", (CoreCommand.Command.Declarator.Remove message, CoreCommand.EmptyReply reply) => { }); dispatcher.SaveCommandsTo("test.duly"); dispatcher.Reset(); dispatcher.LoadCommandsFrom("test.duly"); testCommand( dispatcher, new CoreCommand.Command.Global.RemoveProject { ProjectName = "Testor" }, "GLOBAL.REMOVE_PROJECT", (CoreCommand.Command.Global.RemoveProject cmd, CoreCommand.Command.Global.RemoveProject.Reply reply) => { Assert.IsTrue(reply.Removed.Count == 1); }); }
public void GeneratePositionGraph() { CoreCommand.BinaryManager manager = new CoreCommand.BinaryManager(); uint Position = GenerateObjectInto(manager, "Position", new Dictionary <string, uint> { { "x", (uint)BASE_ID.FLOATING_TYPE }, { "y", (uint)BASE_ID.FLOATING_TYPE }, { "z", (uint)BASE_ID.FLOATING_TYPE } }); Declare.Reply posList; Assert.IsTrue(manager.CallCommand(new Declare { ContainerID = (uint)BASE_ID.GLOBAL_CTX, EntityType = ENTITY.LIST_TYPE, Name = "PositionList", Visibility = VISIBILITY.PUBLIC }, out posList)); Assert.IsTrue(manager.CallCommand(new CoreCommand.Command.List.SetType { ListId = posList.EntityID, TypeId = Position })); Declare.Reply indexList; Assert.IsTrue(manager.CallCommand(new Declare { ContainerID = (uint)BASE_ID.GLOBAL_CTX, EntityType = ENTITY.LIST_TYPE, Name = "IndexList", Visibility = VISIBILITY.PUBLIC }, out indexList)); Assert.IsTrue(manager.CallCommand(new CoreCommand.Command.List.SetType { ListId = indexList.EntityID, TypeId = (uint)BASE_ID.INTEGER_TYPE })); Declare.Reply adjList; Assert.IsTrue(manager.CallCommand(new Declare { ContainerID = (uint)BASE_ID.GLOBAL_CTX, EntityType = ENTITY.LIST_TYPE, Name = "AdjacentList", Visibility = VISIBILITY.PUBLIC }, out adjList)); Assert.IsTrue(manager.CallCommand(new CoreCommand.Command.List.SetType { ListId = adjList.EntityID, TypeId = indexList.EntityID })); GenerateObjectInto(manager, "PositionGraph", new Dictionary <string, uint> { { "positions", posList.EntityID }, { "links", adjList.EntityID } }); manager.SaveCommandsTo("position_graph.dnai"); }