public IEnumerator MsgpackBenchmark()
        {
            Msgpack msgpack = gameObject.AddComponent("Msgpack") as Msgpack;

            msgpack.Type = Types.BODY;

            bool success = true;

            Debug.Log("Start Msgpack Bench");
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            for (int i = 0; i < HTTP_RUNTIME; i++)
            {
                yield return(StartCoroutine(msgpack.Request(GetBigData(i % 100))));

                if (msgpack.IsError)
                {
                    Assert.True(false, "Fail");
                    success = false;
                    break;
                }
            }
            stopWatch.Stop();

            Debug.Log("Msgpack HTTP: n=" + HTTP_RUNTIME
                      + "\r\n   Time:   " + (stopWatch.ElapsedMilliseconds / 1000f).ToString()
                      + "\r\n   Rate:   " + persec(HTTP_RUNTIME, stopWatch.ElapsedMilliseconds) + "/s");


            Assert.True(success);

            DoneTesting();
        }
        public IEnumerator MsgpackBodyTest()
        {
            Msgpack msgpack = gameObject.AddComponent("Msgpack") as Msgpack;

            msgpack.Type = Types.BODY;

            yield return(StartCoroutine(msgpack.Request(GetParam("mtest1", 2))));

            Assert.False(msgpack.IsError);

            Assert.Equal((uint)msgpack.LastResult["int"], 14142);
            Assert.Equal((string)msgpack.LastResult["name"], "mtest1");
            Assert.Equal(msgpack.LastResult["nil"], null);
            Assert.Equal((bool)msgpack.LastResult["bool"], true);

            IList <object> arr = msgpack.LastResult["arr"] as IList <object>;

            Assert.True(arr != null);
            Assert.Equal((int)arr[2], 8);

            IDictionary <string, object> map = msgpack.LastResult["map"] as IDictionary <string, object>;

            Assert.True(map != null);
            Assert.Equal((string)map["foo"], "bar");

            DoneTesting();
        }
        public IEnumerator MsgpackDeserializeBenchmark()
        {
            Msgpack msgpack = gameObject.AddComponent("Msgpack") as Msgpack;
            Dictionary <string, object> data = GetBigData(DATA_LIST_COUNT);

            byte[]    bytes     = msgpack.Serialize(data);;
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            for (int i = 0; i < FUNC_RUNTIME; i++)
            {
                IDictionary <string, object> ret = msgpack.Deserialize(bytes);
            }
            stopWatch.Stop();

            Debug.Log("Msgpack Deserialize: n=" + FUNC_RUNTIME
                      + "\r\n   Time:   " + (stopWatch.ElapsedMilliseconds / 1000f).ToString()
                      + "\r\n   Length: " + bytes.Length
                      + "\r\n   Rate:   " + persec(FUNC_RUNTIME, stopWatch.ElapsedMilliseconds) + "/s");

            Assert.True(true);

            DoneTesting();
            yield break;
        }