# HG changeset patch # User Kazuma # Date 1477197321 -32400 # Node ID 4c8932dad7b23b6a53f6b2339924845660ae3138 # Parent b71d9ea6bd8ea79afa1f71ccfa08bca6ad82cce9 Add Test and only NetworkTreeOperationLogTest.cs not work. diff -r b71d9ea6bd8e -r 4c8932dad7b2 src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs --- a/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs Sun Oct 23 12:25:57 2016 +0900 +++ b/src/main/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodePath.cs Sun Oct 23 13:35:21 2016 +0900 @@ -21,10 +21,6 @@ this.Path = path; } - public IEnumerator iterator () { // iterator error. - yield return this.Path.GetEnumerator().Current; - } - IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); @@ -32,7 +28,7 @@ public IEnumerator GetEnumerator() { - return iterator (); + yield return this.Path.GetEnumerator().Current; } public NodePath add (int pos) { diff -r b71d9ea6bd8e -r 4c8932dad7b2 src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapTest.cs --- a/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapTest.cs Sun Oct 23 12:25:57 2016 +0900 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/junge-main/data/treemap/TreeMapTest.cs Sun Oct 23 13:35:21 2016 +0900 @@ -14,17 +14,6 @@ } - -// for (int count = 100; count > -10; count--) { -// ReturnNumber = map.get(count); -// if(ReturnNumber == null){ -// checknull = false; -// } -// //this points null check. -// if (checknull){ -// Debug.Log(map.get()); -// } - Debug.Log ("end"); } } diff -r b71d9ea6bd8e -r 4c8932dad7b2 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildOperationTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkAppendChildOperationTest.cs Sun Oct 23 13:35:21 2016 +0900 @@ -0,0 +1,18 @@ +using UnityEngine; +using System.Collections; +using MsgPack; + +public class NetworkAppendChildOperationTest : MonoBehaviour { + + // Use this for initialization + void Start () { + NetworkAppendChildAtOperation op = new NetworkAppendChildAtOperation(1); + ObjectPacker pack = new ObjectPacker(); + byte[] value = pack.Pack(op); + + // unpackage + ObjectPacker unpack = new ObjectPacker(); + NetworkAppendChildAtOperation mOp = unpack.Unpack(value); + print(mOp.getPosition()); // add position 1 , get what number? + } +} diff -r b71d9ea6bd8e -r 4c8932dad7b2 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperationTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteAttributeOperationTest.cs Sun Oct 23 13:35:21 2016 +0900 @@ -0,0 +1,18 @@ +using UnityEngine; +using System.Collections; +using MsgPack; + +public class NetworkDeleteAttributeOperationTest : MonoBehaviour { + + // Use this for initialization + void Start () { + NetworkDeleteAttributeOperation op = new NetworkDeleteAttributeOperation("hoge"); + ObjectPacker pack = new ObjectPacker(); + byte[] value = pack.Pack(op); + + // unpackage + ObjectPacker unpack = new ObjectPacker(); + NetworkDeleteAttributeOperation mOp = unpack.Unpack(value); + print(mOp.getKey()); + } +} diff -r b71d9ea6bd8e -r 4c8932dad7b2 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperationTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkDeleteChildAtOperationTest.cs Sun Oct 23 13:35:21 2016 +0900 @@ -0,0 +1,19 @@ +using UnityEngine; +using System.Collections; +using MsgPack; + +public class NetworkDeleteChildAtOperationTest : MonoBehaviour { + + // Use this for initialization + void Start () { + NetworkDeleteChildAtOperation op = new NetworkDeleteChildAtOperation(1); + ObjectPacker pack = new ObjectPacker(); + byte[] value = pack.Pack(op); + + // unpackage + ObjectPacker unpack = new ObjectPacker(); + NetworkDeleteChildAtOperation mOp = unpack.Unpack(value); + print(mOp.getPosition()); + print(mOp.getCommand()); + } +} diff -r b71d9ea6bd8e -r 4c8932dad7b2 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperationTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkNodeOperationTest.cs Sun Oct 23 13:35:21 2016 +0900 @@ -0,0 +1,20 @@ +using UnityEngine; +using System.Collections; +using MsgPack; + +public class NetworkNodeOperationTest : MonoBehaviour { + + // Use this for initialization + void Start () { + NetworkAppendChildAtOperation op = new NetworkAppendChildAtOperation(3); + NetworkNodeOperation nOp = new NetworkNodeOperation(op); + + ObjectPacker pack = new ObjectPacker(); + byte[] value = pack.Pack(nOp); + + ObjectPacker unpack = new ObjectPacker(); + NetworkNodeOperation mnp = unpack.Unpack(value); + print (mnp.getCommand()); + print (mnp.getPosition()); + } +} diff -r b71d9ea6bd8e -r 4c8932dad7b2 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperationTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkPutAttributeOperationTest.cs Sun Oct 23 13:35:21 2016 +0900 @@ -0,0 +1,22 @@ +using UnityEngine; +using System.Collections; +using MsgPack; +using System; + +public class NetworkPutAttributeOperationTest : MonoBehaviour { + + // Use this for initialization + void Start () { + byte[] value = System.Text.ASCIIEncoding.UTF8.GetBytes("test"); + NetworkPutAttributeOperation op = new NetworkPutAttributeOperation("hoge", value); + + ObjectPacker pack = new ObjectPacker(); + // send this byte to server. + byte[] packValue = pack.Pack(op); + + ObjectPacker unpack = new ObjectPacker(); + NetworkPutAttributeOperation nOp = unpack.Unpack(packValue); + print(System.Text.ASCIIEncoding.UTF8.GetString(nOp.getValue())); + print (nOp.getCommand()); + } +} diff -r b71d9ea6bd8e -r 4c8932dad7b2 src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLogTest.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/test/csharp/jp.ac.u-ryukyu.ie.cr/jungle-network/operations/NetworkTreeOperationLogTest.cs Sun Oct 23 13:35:21 2016 +0900 @@ -0,0 +1,26 @@ +using UnityEngine; +using System.Collections; +using MsgPack; + +public class NetworkTreeOperationLogTest : MonoBehaviour { + + // Use this for initialization + void Start () { // not work yet 10/23 13:33 + NetworkAppendChildAtOperation op = new NetworkAppendChildAtOperation(1); + NetworkNodePath path = new NetworkNodePath(); + NodePath npath = path.add(1).add(2); + NetworkTreeOperationLog log = new NetworkTreeOperationLog(); + log.add(npath, op); + log.add(npath, op); + ObjectPacker pack = new ObjectPacker(); + byte[] value = pack.Pack(log); + + // unpackage + ObjectPacker unpack = new ObjectPacker(); + NetworkTreeOperationLog mOp = unpack.Unpack(value); + foreach (var m in mOp) { + print(m.getNodePath().size()); + print(m.getNodeOperation()); + } + } +}