Exemple #1
0
        private void Test_JsonAPI_LoadFromFile()
        {
            var classA = JsonAPI.LoadFromFile <ClassA>("JsonAPITest");

            Debug.Assert(classA != null);
            Debug.Assert(classA.a == -3);
            Debug.Assert(classA.b == -0.4f);
            Debug.Assert(classA.c);
            Debug.Assert(classA.d == "f**k");

            Debug.Assert(classA.e != null);
            for (int i = 0; i < classA.e.Count; ++i)
            {
                Debug.Assert(classA.e[i] == i + 1);
            }

            Debug.Assert(classA.f != null);
            foreach (var kv in classA.f)
            {
                Debug.Assert(kv.Key == kv.Value);
            }

            Debug.Assert(classA.g != null);
            Debug.Assert(classA.g.a == 10);
            Debug.Assert(classA.g.b == 3.3f);

            Debug.Assert(classA.h != null);
            Debug.Assert(classA.h.x == 2.0f);
            Debug.Assert(classA.h.y == 3.0f);
            Debug.Assert(classA.h.z == 4.0f);
            //Debug.Log(sizeof(classA));
            Debug.Log("Test_JsonAPI_LoadFromFile FINISH");
        }
Exemple #2
0
        private void Test_Profiler_JsonAPI()
        {
            Debug.Log("Test_Profiler_JsonAPI Begin");
            var now1 = System.DateTime.Now;

            for (int i = 0; i < TEST_LEN; ++i)
            {
                var c = JsonAPI.LoadFromFile <ClassC>("ClassC");
            }
            var now2 = System.DateTime.Now;
            var diff = now2 - now1;

            Debug.Log("Cost ms: " + diff.TotalMilliseconds);
            Debug.Log("Test_Profiler_JsonAPI Finish");
        }